I looked at Ene's wxPython remake of vegaseat's fancy Tkinter GUI "Hello World!" code, and used the Boa Constructor IDE to do this. It took only a few minutes to create this wxPython code, since Boa has a drag/drop frame builder and writes most of the code:
# fancy "Hello World!" wxPython code generated mostly by Boa Constructor
# Boa Constructor (needs wxPython, has drag/drop frame builder, debugger etc.)
# Further development may have stopped. Download free from:
# http://freshmeat.net/redir/boa-constructor/832/url_zip/boa-constructor-0.4.4.zip
#Boa:Frame:Frame1
import wx
def create(parent):
return Frame1(parent)
[wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1BUTTON2, wxID_FRAME1STATICTEXT1,
] = [wx.NewId() for _init_ctrls in range(4)]
class Frame1(wx.Frame):
def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
pos=wx.Point(396, 174), size=wx.Size(391, 178),
style=wx.DEFAULT_FRAME_STYLE, title=u'Hello World from DaniWeb!')
self.SetClientSize(wx.Size(383, 138))
self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
label=u' Hello World! ', name='staticText1', parent=self,
pos=wx.Point(0, 0), size=wx.Size(385, 84), style=0)
self.staticText1.SetBackgroundColour(wx.Colour(255, 255, 0))
self.staticText1.SetForegroundColour(wx.Colour(255, 0, 0))
self.staticText1.SetFont(wx.Font(36, wx.SWISS, wx.NORMAL, wx.NORMAL,
False, u'Comic Sans MS'))
self.button1 = wx.Button(id=wxID_FRAME1BUTTON1, label=u'white on blue',
name='button1', parent=self, pos=wx.Point(56, 96),
size=wx.Size(96, 28), style=0)
self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
id=wxID_FRAME1BUTTON1)
self.button2 = wx.Button(id=wxID_FRAME1BUTTON2, label=u'blue on green',
name='button2', parent=self, pos=wx.Point(216, 96),
size=wx.Size(103, 28), style=0)
self.button2.Bind(wx.EVT_BUTTON, self.OnButton2Button,
id=wxID_FRAME1BUTTON2)
def __init__(self, parent):
self._init_ctrls(parent)
def OnButton1Button(self, event):
# I had to add these lines, Boa generates the rest
self.staticText1.SetBackgroundColour("blue")
self.staticText1.SetForegroundColour("white")
self.staticText1.SetLabel(" Hello World! ")
#event.Skip()
def OnButton2Button(self, event):
# I had to add these lines, Boa generates the rest
self.staticText1.SetBackgroundColour("green")
self.staticText1.SetForegroundColour("blue")
self.staticText1.SetLabel(" Hello World! ")
#event.Skip()
if __name__ == '__main__':
app = wx.PySimpleApp()
wx.InitAllImageHandlers()
frame = create(None)
frame.Show()
app.MainLoop()