Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 24th, 2008, 2:29 PM   #1
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
wxPython listboxsize

well thanks to sane ive started looking at GUI already using wxPython, however i am having a small issue. I am using the code below to try to produce a 200x380 list bow however, when i run my code i get a very small list box in the top left corner which is correct positioning but completley the wrong size. After looking over my code i cannot see where i am making the mistake. So i would be greatful if you could shed some light on the situation

python Syntax (Toggle Plain Text)
  1. class mainWin(wx.Frame):
  2. def __init__(self, parent, id, title):
  3. wx.Frame.__init__(self, parent, id, title, size=(220, 490), style=wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX)
  4.  
  5.  
  6. panel = wx.Panel(self, -1)
  7. hbox = wx.BoxSizer(wx.HORIZONTAL)
  8.  
  9. self.listbox = wx.ListBox(panel, -1,size=(200,380))
  10. hbox.Add(self.listbox, 1,wx.EXPAND | wx.ALL, 5)
  11.  
  12. new = wx.Button(self, 1, 'Message User', (10, 435))
  13. end = wx.Button(self, 2, 'Exit', (120, 435))
  14.  
  15. hbox.Add(new)
  16. hbox.Add(end)
  17.  
  18. panel.SetSizer(hbox)
  19. self.Centre()
  20. self.Show(True)

Thanks
Freaky Chris is offline   Reply With Quote
Old Mar 24th, 2008, 3:15 PM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,799
Rep Power: 5 Sane will become famous soon enough
Re: wxPython listboxsize

I believe the size parameter must be of the type "wx.Size", and not a tuple. This may or may not fix the problem. If it does not fix the problem, it may have to do with the size of your panel and slider. A control can only take up a maximum size of what it's being placed inside.

Try:
self.listbox = wx.ListBox(panel, -1,size=wx.Size(200,380))
Sane is offline   Reply With Quote
Old Mar 24th, 2008, 3:21 PM   #3
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: wxPython listboxsize

Ah, how foolish of me. Thank you for pointing out the obvious. I had forgot to specify the size of the panel. Meaning it was it default size which is something like 10x10.

it doesn't need to be of type wx.Size() it accepts tuples perfectly well. But thanks for showing me the obvoius.

Im glad i decided to look at wxPython after looking at it and Tkinter it is the better in my opionion.

Chris
Freaky Chris is offline   Reply With Quote
Old Mar 24th, 2008, 3:35 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,799
Rep Power: 5 Sane will become famous soon enough
Re: wxPython listboxsize

Oh, so it does accept tuples as well? And all this time I've been using wx.Size and wx.Point everywhere. What a waste of keystrokes. Haha.

I would assume wxPython is more geared towards making powerful GUIs, to obtain complete control over the class hierarchy of events and windows. If you want a simple GUI, Tkinter may be the better choice. It's always good to try out both and see which one works for you. Good luck.
Sane is offline   Reply With Quote
Old Mar 24th, 2008, 3:45 PM   #5
Freaky Chris
Hobbyist Programmer
 
Freaky Chris's Avatar
 
Join Date: Dec 2007
Location: England
Posts: 169
Rep Power: 1 Freaky Chris is on a distinguished road
Send a message via MSN to Freaky Chris
Re: wxPython listboxsize

Yes thats the impression i got from the two. I did have a quick reader of Tkinter and i much prefer wxPython, hehe i guess you can always learn something new xD
Freaky Chris is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set application Icon wxPython OpenLoop Python 5 Mar 9th, 2008 5:46 PM
Downloading Tkinter and Wxpython Swan Python 6 Feb 21st, 2008 9:34 PM
More Mac Issues - wxPython Sane Python 3 Nov 23rd, 2007 12:16 PM
Glade and wxPython? titaniumdecoy Python 7 Jul 2nd, 2006 9:54 PM
wxPython Help Sane Python 25 Jun 2nd, 2006 5:57 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:50 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC