Hi!
I'm new to wxPython and I kinda run in circle with this simple counter program.
Why is it that the loop counter doesn't show up?
import sys, os, time
from wxPython.wx import *
class MyFrame(wxFrame):
def __init__(self, parent, ID, title):
wxFrame.__init__(self, parent, ID, title,
wxDefaultPosition, wxSize(200, 100))
self.panel = panel = wxPanel(self, -1)
wxStaticText(panel, -1, "Simple counter",
wxDLG_PNT(panel, wxPoint(4, 14)), wxDefaultSize)
self.counter = wxTextCtrl(panel, -1, "",
wxDLG_PNT(panel, wxPoint(60, 14)),
wxDLG_SZE(panel, wxSize(36, -1)),
wxTE_READONLY)
class MyApp(wxApp):
def OnInit(self):
self.frame = MyFrame(NULL, -1, "Simple Counter Demo")
self.frame.Show(true)
self.SetTopWindow(self.frame)
return true
def Mainloop(self):
counter = 1
while counter <= 100:
self.frame.counter.SetValue("%s" % counter)
counter += 1
time.sleep(0.25)
def main():
app = MyApp(1)
app.MainLoop()
if __name__ == '__main__':
main()
Thanx,
Richard Nault