| | |
wxPython help please?
Thread Solved |
•
•
Join Date: Jan 2008
Posts: 1
Reputation:
Solved Threads: 0
I'm relatively new to programming in wxPython and I have been trying to put a BoxSizer within a wx.Window. This only results in a small square (which is the panel within the BoxSizer) appearing in the window. Could somebody please tell me what I'm doing wrong?
Sample code:
Thanks in advance!
Sample code:
class TestPanel(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, -1, size = (800, 400)) win = wx.Window (self, -1) box = wx.BoxSizer(wx.VERTICAL) panel2 = wx.Panel(win) panel2.SetBackgroundColour("Red") box.Add(panel2, 1, wx.EXPAND, 10) self.SetSizer(box)
Is this what you want ...
python Syntax (Toggle Plain Text)
import wx class TestPanel(wx.Frame): def __init__(self, parent, id): wx.Frame.__init__(self, parent, -1, 'wx.BoxSizer test', size = (800, 400)) #win = wx.Window (self, -1) box = wx.BoxSizer(wx.VERTICAL) panel1 = wx.Panel(self) panel1.SetBackgroundColour("green") # 1=stretch allowed, and use 10 pixel border box.Add(panel1, 1, wx.ALL|wx.EXPAND, 10) panel2 = wx.Panel(self) panel2.SetBackgroundColour("Red") box.Add(panel2, 1, wx.ALL|wx.EXPAND, 10) self.SetSizer(box) # show the frame self.Show(True) app = wx.PySimpleApp() tp = TestPanel(None, -1) app.MainLoop()
May 'the Google' be with you!
![]() |
Similar Threads
- Instal of wxPython (Python)
- no WxPython here? (Python)
Other Threads in the Python Forum
- Previous Thread: Drawing a moving circle with Python Tkinter + good GUI tutorial
- Next Thread: Bug in my program
| Thread Tools | Search this Thread |
address alarm anydbm app beginner cipher conversion coordinates curves cx-freeze data development dictionary directory dynamic examples excel feet file float format function generator getvalue gui halp handling homework images import input ip itunes java keycontrol line linux list lists loan loop maintain maze millimeter mouse mysqldb number numbers output parsing path port prime programming projects py2exe pygame pyglet pymailer python queue random recursion recursive screensaverloopinactive script scrolledtext searchingfile shebang slicenotation split ssh string strings table terminal text thread threading time tlapse tooltip tuple tutorial type ubuntu unicode url urllib urllib2 variable variables ventrilo verify vigenere web webservice wx.wizard wxpython xlwt






