Application abort while icon is removed from Notebook ctrl

16 views
Skip to first unread message

linuxNewBee

unread,
Apr 16, 2015, 1:42:55 PM4/16/15
to wxpytho...@googlegroups.com
I have a notebook and I am adding a new page with

def AddNewPage(self,page,title):
play_id = wx.Image(Icons.play, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
index = self.noteBook.GetPageCount()
self.noteBook.InsertPage(index, page, title, 1, play_id)

Once that page is created user will add some input..and after that I want to
remove the icon.

def RemoveIcon(self,index):

self.noteBook.SetPageBitmap(page_idx=index,bitmap=wx.EmptyBitmap(1,1))

It work most of the time but sometime it gives following error and
application abort:
Xlib: unexpected async reply (sequence 0x6cc8)





--
View this message in context: http://wxpython-users.1045709.n5.nabble.com/Application-abort-while-icon-is-removed-from-Notebook-ctrl-tp5724038.html
Sent from the wxPython-users mailing list archive at Nabble.com.

daniel.fo...@gmail.com

unread,
Apr 24, 2015, 4:47:46 AM4/24/15
to wxpytho...@googlegroups.com
Just a thought, are you using threading in your application? Remember that only the main thread should ever talk to the GUI, otherwise you can occationally get errors simila to what you describe. If your RemoveIcon is ever called from a different thread you should make sure to call self.noteBook.SetPageBitmap with wx.CallAfter. See the last example here http://wiki.wxpython.org/LongRunningTasks.

/Daniel
Reply all
Reply to author
Forward
0 new messages