DBQ
August 30th, 2011, 12:19 AM
Hi Everybody,
I have an application which calls wx from Tkinter. Here is the wx code I am trying to run (changed it from http://stackoverflow.com/questions/4767808/new-wxnotebook-pages-stay-empty-in-wxpython). It resides in the module which I import in the main program.
import wx
def run(nb):
for i in range(1, 5, 1):
adp(nb, i)
def adp(nb, p):
newpage = Page(nb)
newpage.SetBackgroundColour(wx.GREEN)
wx.StaticText(newpage, -1, "PAGE "+str(p), style=wx.ALIGN_CENTRE)
wx.CallAfter(nb.AddPage, newpage, "Page "+str(p))
class Page(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
wx.StaticText(self, -1, "This is a Page object", (20,20))
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Notebook Test")
p = wx.Panel(self)
self.nb = wx.Notebook(p)
self.page1 = Page(self.nb)
sizer = wx.BoxSizer()
sizer.Add(self.nb, 1, wx.EXPAND)
p.SetSizer(sizer)
def funkyfunc():
app = wx.App()
mf = MainFrame()
mf.Show()
mf.nb.AddPage(mf.page1, "Testseite 1")
run(mf.nb)
app.MainLoop()
In my Tkinter code, when the user clicks on a menu, I simply call funkyFunc() to show my wx notebook. After I close the notebook, and then close the main tkinter app, on exit I get the following error:
The program 'python' received an X Window System error.
This probably reflects a bug in the program.
The error was 'RenderBadPicture (invalid Picture parameter)'.
(Details: serial 1040 error_code 164 request_code 155 minor_code 7)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Note, other oddities happen as well after closing the wx form. For example, not being able to write to a proc file which I can do before (yes, that /proc file was meant to be writable).
Please help! I spent hours trying to figure this out...
Note: everything works fine when I do not call the wx.
I have an application which calls wx from Tkinter. Here is the wx code I am trying to run (changed it from http://stackoverflow.com/questions/4767808/new-wxnotebook-pages-stay-empty-in-wxpython). It resides in the module which I import in the main program.
import wx
def run(nb):
for i in range(1, 5, 1):
adp(nb, i)
def adp(nb, p):
newpage = Page(nb)
newpage.SetBackgroundColour(wx.GREEN)
wx.StaticText(newpage, -1, "PAGE "+str(p), style=wx.ALIGN_CENTRE)
wx.CallAfter(nb.AddPage, newpage, "Page "+str(p))
class Page(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent)
wx.StaticText(self, -1, "This is a Page object", (20,20))
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title="Notebook Test")
p = wx.Panel(self)
self.nb = wx.Notebook(p)
self.page1 = Page(self.nb)
sizer = wx.BoxSizer()
sizer.Add(self.nb, 1, wx.EXPAND)
p.SetSizer(sizer)
def funkyfunc():
app = wx.App()
mf = MainFrame()
mf.Show()
mf.nb.AddPage(mf.page1, "Testseite 1")
run(mf.nb)
app.MainLoop()
In my Tkinter code, when the user clicks on a menu, I simply call funkyFunc() to show my wx notebook. After I close the notebook, and then close the main tkinter app, on exit I get the following error:
The program 'python' received an X Window System error.
This probably reflects a bug in the program.
The error was 'RenderBadPicture (invalid Picture parameter)'.
(Details: serial 1040 error_code 164 request_code 155 minor_code 7)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Note, other oddities happen as well after closing the wx form. For example, not being able to write to a proc file which I can do before (yes, that /proc file was meant to be writable).
Please help! I spent hours trying to figure this out...
Note: everything works fine when I do not call the wx.