Fanto
Fanto

Reputation: 148

wxPython possible Notebook GetPage bug

I have made this simple code for testing the notebook methods, and i found something very strange for me, but i'm not a python/wxpython expert than i decided to ask you if i made something wrong, or if this is a bug. The code is:

import wx
class Note(wx.Notebook):
    def __init__(self, parent):
        wx.Notebook.__init__(self, parent)
        self.dummy = 0#or self.panel = wx.Panel(self) or evry other thing with the self.
        wx.Notebook.AddPage(self, wx.Panel(self), 'page')
app = wx.App()
f = wx.Frame(None)
n = Note(f)
#the code works up to here
n.GetPage(0)#with this line the progra crash

When i place on the Note class a object variable(like self.) the program crash when i call the GetPage method. This is the only method of the notebook that make this thing and i really don't know why. My python version is 3.4.3 and the wxPython Phoenix version is the 3.0.3.

Upvotes: 0

Views: 188

Answers (1)

user5932261
user5932261

Reputation: 61

I was able to get round the problem by replacing the GetPage(0) code selecting the given page and then retriving the it.

#n.GetPage(0)#with this line the progra crash
n.ChangeSelection(0) 
aPage = n.GetCurrentPage()
print( aPage) 

This gets round the crash which I am experiencing on Microsoft Windows 7 Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32 with Phoenix builds including the latest 3.0.3.dev1826+ccc36fe msw (phoenix)

Upvotes: 1

Related Questions