Application abort while icon is removed from Notebook ctrl

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.

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 LongRunningTasks - wxPyWiki.

/Daniel

···

On Thursday, April 16, 2015 at 7:42:55 PM UTC+2, LinuxnewBee wrote:

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.