Honestly, I am not quite sure how to explain this...
I have a 24 Line GUI wxPython Class that has no Events and Two Functions...
These Functions are: Clear the Display and Add a Line from the Bottom.
I want to use this Frame from beginning to end of the program to Log Events and Test Results for the User... I am *not* interested in Logging to the Console. In fact I do *not* want the Console to be visible at all. (But, that's another issue.)
When I use the following code without bringing another Form Up, the Form Initializes but does not completely fill-in.
When I bring up another Form, the LogScrn GUI fills in and accepts the next .AddLine()
But, when I "Continue" from that second GUI everything halts until I close the LogScrn GUI.
I may need to spawn a second thread for the LogScrn gui? But, I do *not* know how to do that, and even if I did I wouldn't know how to "talk" to the LogScrn from the rest of my code...
As a Python/wxPython newbie I am not even sure how to frame the search to find an answer...
Help (anyone have a drowning programmer animated Smilie?)
logapp =wx.PySimpleApp(0)
wx.InitAllImageHandlers()
LogScrn = Lines_24(None, -1, "")
LogScrn.AddLine("This is the Log Screen Started at: ")
LogScrn.Show()
note that there is no .MainLoop because I realize that that would halt all program execution until the LogScrn GUI is Destroyed
My Class is as follows
class Lines_24(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: Display_Main.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.Line_1 = wx.TextCtrl(self, -1, "")
self.Line_2 = wx.TextCtrl(self, -1, "")
self.Line_3 = wx.TextCtrl(self, -1, "")
self.Line_4 = wx.TextCtrl(self, -1, "")
self.Line_5 = wx.TextCtrl(self, -1, "")
self.Line_6 = wx.TextCtrl(self, -1, "")
self.Line_7 = wx.TextCtrl(self, -1, "")
self.Line_8 = wx.TextCtrl(self, -1, "")
self.Line_9 = wx.TextCtrl(self, -1, "")
self.Line_10 = wx.TextCtrl(self, -1, "")
self.Line_11 = wx.TextCtrl(self, -1, "")
self.Line_12 = wx.TextCtrl(self, -1, "")
self.Line_13 = wx.TextCtrl(self, -1, "")
self.Line_14 = wx.TextCtrl(self, -1, "")
self.Line_15 = wx.TextCtrl(self, -1, "")
self.Line_16 = wx.TextCtrl(self, -1, "")
self.Line_17 = wx.TextCtrl(self, -1, "")
self.Line_18 = wx.TextCtrl(self, -1, "")
self.Line_19 = wx.TextCtrl(self, -1, "")
self.Line_20 = wx.TextCtrl(self, -1, "")
self.Line_21 = wx.TextCtrl(self, -1, "")
self.Line_22 = wx.TextCtrl(self, -1, "")
self.Line_23 = wx.TextCtrl(self, -1, "")
self.Line_24 = wx.TextCtrl(self, -1, "")
self.texts=[]
for i in range(24):
# print "Line_%d" %i
self.texts.append(getattr(self, "Line_%d" %(i+1)) )
self.__set_properties()
self.__do_layout()
# end wxGlade
def __set_properties(self):
# begin wxGlade: Display_Main.__set_properties
self.SetTitle("TPS Display")
for i in range(0, 24):
self.texts[i].SetMinSize((640, 22))
self.texts[i].SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, ""))
self.texts[i].Enable(True)
def __do_layout(self):
# begin wxGlade: Display_Main.__do_layout
sizer_1 = wx.BoxSizer(wx.VERTICAL)
sizer_1.Add(self.Line_1, 0, 0, 0)
sizer_1.Add(self.Line_2, 0, 0, 0)
sizer_1.Add(self.Line_3, 0, 0, 0)
sizer_1.Add(self.Line_4, 0, 0, 0)
sizer_1.Add(self.Line_5, 0, 0, 0)
sizer_1.Add(self.Line_6, 0, 0, 0)
sizer_1.Add(self.Line_7, 0, 0, 0)
sizer_1.Add(self.Line_8, 0, 0, 0)
sizer_1.Add(self.Line_9, 0, 0, 0)
sizer_1.Add(self.Line_10, 0, 0, 0)
sizer_1.Add(self.Line_11, 0, 0, 0)
sizer_1.Add(self.Line_12, 0, 0, 0)
sizer_1.Add(self.Line_13, 0, 0, 0)
sizer_1.Add(self.Line_14, 0, 0, 0)
sizer_1.Add(self.Line_15, 0, 0, 0)
sizer_1.Add(self.Line_16, 0, 0, 0)
sizer_1.Add(self.Line_17, 0, 0, 0)
sizer_1.Add(self.Line_18, 0, 0, 0)
sizer_1.Add(self.Line_19, 0, 0, 0)
sizer_1.Add(self.Line_20, 0, 0, 0)
sizer_1.Add(self.Line_21, 0, 0, 0)
sizer_1.Add(self.Line_22, 0, 0, 0)
sizer_1.Add(self.Line_23, 0, 0, 0)
sizer_1.Add(self.Line_24, 0, 0, 0)
self.SetSizer(sizer_1)
sizer_1.Fit(self)
self.Layout()
# end wxGlade
def Clear(self):
for i in range(25):
self.texts[i].SetValue = ""
def AddLine(self,uText):
for i in range(0,23):
self.texts[i].SetValue(self.texts[i+1].GetValue())
self.texts[23].SetValue(" " + uText)
# end of class Lines_24