Hello,
I am using fedora 5 and installed wxpython in an effort to program in python/wxpython (installed wxPython-2.6.3.2-1.fc5.i386.rpm, wxGTK-2.6.3-2.6.3.2.1.fc5.i386.rpm and wxGTK-gl-2.6.3-2.6.3.2.1.fc5.i386.rpm).
When I run my test script to create a frame, a notebook and an image on one of the pages of the notebook, I get a GDK error when the application closes:
(python:20707): Gdk-CRITICAL **: gdk_drawable_get_depth: assertion `GDK_IS_DRAWABLE (drawable)' failed
(python:20707): Gtk-CRITICAL **: gtk_pixmap_set: assertion `gdk_colormap_get_visual (gtk_widget_get_colormap (GTK_WIDGET (pixmap)))->depth == gdk_drawable_get_depth (GDK_DRAWABLE (val))' failed
The same error occurs after closing the wxpython demo application (demo.py) available from the wxpython web site if you're viewing their notebook code example on which an image (a yellow happy face) appears on a notebook page.
If I avoid placing an image on the page of the notebook by negating the line 'self.mainnotebook.SetPageImage(self.mainnotebook.GetPageCount()-1, self.idx1)', the error disappears.
Can anyone help me solve this annoying problem, as I want the pages of my notebook to have images. The png image I am showing (test.png in my test script) is a stock image (24x24) I obtained from my fc5 installation. Any assistance will be appreciated.
My test.py script follows:
#!/usr/bin/python
import wx
import os
daappfolderpath = os.path.dirname(__file__)
class damainframe(wx.Frame):
def __init__(self, parent, ID, title):
wx.Frame.__init__(self, parent, -1, title)
self.Bind(wx.EVT_CLOSE, self.closeapp)
self.mainbox = wx.BoxSizer(wx.VERTICAL)
# make notebook
self.mainnotebook = wx.Notebook(self,-1)
self.frontispiecepanel = wx.Panel(self.mainnotebook, -1)
self.mainnotebook.AddPage(self.frontispiecepanel, " page 1 ", False)
self.pdfpanel = wx.Panel(self.mainnotebook, -1)
self.mainnotebook.AddPage(self.pdfpanel, " page 2 ", False)
self.sendpanel = wx.Panel(self.mainnotebook, -1)
self.mainnotebook.AddPage(self.sendpanel, " page 3 ", False)
# make image list for mainnotebook
self.il = wx.ImageList(24, 24)
self.idx1 = self.il.Add(wx.Bitmap(os.path.join(daappfolderpath, "test.png"),wx.BITMAP_TYPE_PNG))
self.mainnotebook.AssignImageList(self.il)
self.mainnotebook.SetPageImage(self.mainnotebook.GetPageCount()-1, self.idx1)
self.mainbox.Add(self.mainnotebook, 1, wx.EXPAND)
self.SetAutoLayout(True)
self.SetSizer(self.mainbox)
self.Layout()
self.CreateStatusBar()
def closeapp(self, evt):
self.Destroy()
class daapp(wx.App):
def OnInit(self):
frame = damainframe(None, -1, "")
self.SetTopWindow(frame)
frame.Show(True)
return True
app = daapp(0)
app.MainLoop()