Hey,
I'm writing a small application which creates a wxNotebook. It offers a Dialog to choose several options. For each Option a Tab is inserted in the wxNotebook and filled with a TextCtrl.
This part of the code is working.
However, after adding a Tabs the Frame doesn't refresh. This means that no Tabs are displayed until I minimize or resize the applications frame manually.
It browsed through the wxWidgets Help, the Mailinglist Archive and the ASPN Cookbook, but I couldn't find an answer on my problem.
Does anybody know this symptom ? Does anybody have a solution ?
I already tried to use:
wxWindow.Update()
wxWindow.Refresh()
and other various parameters, suggested by the wxWidgets Help, in the Constructor.
but it didn't help.
I attached the code of the software. It should work easily.
Thanks,
Tobias
-----snip-----
#Using Pywin32 Build 210 / Python 2.5 / Unicode / wxWidgets 2.8.3 /WinXPSp2
import wx
ID_TEST = 101
class MainWindow(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title='Test Application', size=(600,600), style =wx.DEFAULT_FRAME_STYLE)
#create a Menubar with an entry
self.CreateStatusBar()
filemenu = wx.Menu()
filemenu.Append(ID_TEST, "&Test")
Menubar = wx.MenuBar()
Menubar.Append(filemenu, "&File")
self.SetMenuBar(Menubar)
wx.EVT_MENU(self, ID_TEST, self.OnTest)
#create a Notebook (but don't display it right now)
self.nb = wx.Notebook(self, style = wx.BK_DEFAULT|wx.NB_MULTILINE)
self.nb.Show(0)
self.Show(1)
def OnTest(self, evt):
#select an Option from a list
self.nb.Show(1)
option_list = self.SelectOptions()
#create a Panel for each selected Option
for option_name in option_list:
p = wx.Panel(self.nb, 1)
self.nb.AddPage(p, option_name)
#Select the panels and create one textbox on each panel
for x in range(self.nb.GetPageCount()):
p=self.nb.GetPage(x)
self.nb.ChangeSelection(x)
p_text = wx.TextCtrl(p, 1, size=(590,510), value="Loading...", style=wx.TE_MULTILINE, name = "Textbox")
#Place the Textfield on the Panel by using a sizer
p.sizer=wx.BoxSizer(wx.VERTICAL)
p.sizer.Add(p_text,1,wx.EXPAND|wx.ALL, 5)
p.SetSizer(p.sizer)
p.SetAutoLayout(1)
p.sizer.Fit(p)
p.Show(1)
def SelectOptions(self):
#This dialog offers several options to choose
choice = ['Network Protocols', 'Installed Software', 'Processes', 'Registry', 'Network']
diag = wx.MultiChoiceDialog(self, 'Test', 'Selection', choice)
if diag.ShowModal() == wx.ID_OK:
selections = diag.GetSelections()
strings = [choice[x] for x in selections]
return strings
else:
return[]
diag.Destroy()
app = wx.PySimpleApp()
frame = MainWindow(None, -1, "Test Application")
app.MainLoop()
···
--
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail