Problem with a wx notebook

F

faucheuse

Hi there,

I've created a wx NoteBook in wich I set multiples panels in wich I
set one or more sizers. But nothing displays in the notebook,
everything is outside. I've been searching an answer for 2 days ><.
Can you help me plz ? Here is my code(with only one panel, to sum up
the code) :

class StreamingActivationDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: StreamingActivationDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.bitmap_1_copy = wx.StaticBitmap(self, -1, wx.Bitmap("img\
\logo.png", wx.BITMAP_TYPE_ANY))
self.labelDnD = wx.StaticText(self, -1, "Si vous avez déjà un
fichier d'activation, faite le glisser dans cette fenetre")
self.keyBitmap = wx.StaticBitmap(self, -1, wx.Bitmap("img\
\key.bmp", wx.BITMAP_TYPE_ANY))
self.conclude = wx.StaticText(self, -1, _("test"),
style=wx.ALIGN_CENTRE)

### Panel ###
self.intro3_label = wx.StaticText(self, -1, "Envoyez un mail à
\[email protected]\ncontenant le code :",style=wx.ALIGN_CENTRE)
self.activationCode_label= wx.StaticText(self, -1,
"123456789", style=wx.TE_READONLY)
self.copy2_Button = wx.Button(self, -1, "Copier dans le presse-
papier")
self.copy2_Button.Bind(wx.EVT_BUTTON, PanelMail.onCopy)
##############

self.note = wx.Notebook(self, wx.ID_ANY, style=wx.BK_LEFT,
size=wx.Size(100, 341))
self.page3 = wx.Panel(self.note)

imagelist = wx.ImageList(94, 94)
bitmap1 = wx.Bitmap("img\\a.bmp", wx.BITMAP_TYPE_BMP )
imagelist.Add(bitmap1)
self.note.AssignImageList(imagelist)

self.__set_properties()
self.__do_layout()
# end wxGlade

def __set_properties(self):
# begin wxGlade: StreamingActivationDialog.__set_properties
self.SetTitle(_("Activation de FlashProcess"))
self.SetBackgroundColour(wx.Colour(255, 255, 255))
#self.linkProblem.SetForegroundColour(wx.Colour(0, 0, 0))
# end wxGlade

def __do_layout(self):
# begin wxGlade: StreamingActivationDialog.__do_layout
self.grid_sizer_1 = wx.FlexGridSizer(6, 1, 0, 0)
self.grid_sizer_2 = wx.FlexGridSizer(1, 2, 0, 30)
self.grid_sizer_1.Add(self.bitmap_1_copy, 0, wx.TOP|wx.BOTTOM|
wx.EXPAND, 10)


### Page 3 ###
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.intro3_label, 0, wx.BOTTOM|wx.ALIGN_CENTER, 5)
sizer.Add(self.activationCode_label, 0, wx.BOTTOM|
wx.ALIGN_CENTER, 20)
sizer.Add(self.copy2_Button, 0, wx.ALIGN_CENTER, 20)

self.page3.SetSizer(sizer)
sizer.Fit(self.page3)
##############

self.note.AddPage(self.page3, "", False, 0)

self.Bind(wx.EVT_TOOLBOOK_PAGE_CHANGED, self.OnPageChanged)
self.Bind(wx.EVT_TOOLBOOK_PAGE_CHANGING, self.OnPageChanging)

self.grid_sizer_1.Add(self.note, 0, wx.EXPAND, 20)
self.grid_sizer_1.Add(self.labelDnD, 0, wx.TOP|
wx.ALIGN_CENTER_HORIZONTAL, 20)
self.grid_sizer_2.Add(self.keyBitmap, 0, wx.LEFT, 10)
self.grid_sizer_2.Add(self.labelDnD, 0, wx.LEFT, 20)
self.grid_sizer_1.Add(self.grid_sizer_2, 0, wx.EXPAND, 20)
self.grid_sizer_1.Add(self.conclude, 0, wx.TOP|
wx.ALIGN_CENTER_HORIZONTAL, 20)

self.SetSizer(self.grid_sizer_1)
self.grid_sizer_1.Fit(self)
self.Layout()
# end wxGlade

def OnPageChanged(self, event):
event.Skip()

def OnPageChanging(self, event):
event.Skip()
 
P

Prasad, Ramit

-----Original Message-----
From: [email protected] [mailto:p[email protected]] On Behalf Of faucheuse
Sent: Monday, October 17, 2011 5:33 AM
To: (e-mail address removed)
Subject: Problem with a wx notebook

Hi there,

I've created a wx NoteBook in wich I set multiples panels in wich I
set one or more sizers. But nothing displays in the notebook,
everything is outside. I've been searching an answer for 2 days ><.
Can you help me plz ? Here is my code(with only one panel, to sum up
the code) :

class StreamingActivationDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: StreamingActivationDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.bitmap_1_copy= wx.StaticBitmap(self, -1, wx.Bitmap("img\
\logo.png", wx.BITMAP_TYPE_ANY))
self.labelDnD = wx.StaticText(self, -1, "Si vous avez déjà un
fichier d'activation, faite le glisser dans cette fenetre")
self.keyBitmap = wx.StaticBitmap(self,-1, wx.Bitmap("img\
\key.bmp", wx.BITMAP_TYPE_ANY))
self.conclude = wx.StaticText(self, -1, _("test"),
style=wx.ALIGN_CENTRE)

### Panel ###
self.intro3_label = wx.StaticText(self, -1, "Envoyez un mail à
\[email protected]\ncontenant le code :",style=wx.ALIGN_CENTRE)
self.activationCode_label= wx.StaticText(self, -1,
"123456789", style=wx.TE_READONLY)
self.copy2_Button = wx.Button(self, -1, "Copier dans le presse-
papier")
self.copy2_Button.Bind(wx.EVT_BUTTON, PanelMail.onCopy)
##############

self.note = wx.Notebook(self, wx.ID_ANY, style=wx.BK_LEFT,
size=wx.Size(100, 341))
self.page3 = wx.Panel(self.note)

imagelist = wx.ImageList(94, 94)
bitmap1 = wx.Bitmap("img\\a.bmp", wx.BITMAP_TYPE_BMP )
imagelist.Add(bitmap1)
self.note.AssignImageList(imagelist)

self.__set_properties()
self.__do_layout()
# end wxGlade

def __set_properties(self):
# begin wxGlade: StreamingActivationDialog.__set_properties
self.SetTitle(_("Activation de FlashProcess"))
self.SetBackgroundColour(wx.Colour(255, 255, 255))
#self.linkProblem.SetForegroundColour(wx.Colour(0, 0, 0))
# end wxGlade

def __do_layout(self):
# begin wxGlade: StreamingActivationDialog.__do_layout
self.grid_sizer_1 = wx.FlexGridSizer(6, 1, 0, 0)
self.grid_sizer_2 = wx.FlexGridSizer(1, 2, 0, 30)
self.grid_sizer_1.Add(self.bitmap_1_copy, 0, wx.TOP|wx.BOTTOM|
wx.EXPAND, 10)


### Page 3 ###
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.intro3_label, 0, wx.BOTTOM|wx.ALIGN_CENTER, 5)
sizer.Add(self.activationCode_label, 0, wx.BOTTOM|
wx.ALIGN_CENTER, 20)
sizer.Add(self.copy2_Button, 0, wx.ALIGN_CENTER, 20)

self.page3.SetSizer(sizer)
sizer.Fit(self.page3)
##############

self.note.AddPage(self.page3, "", False, 0)

self.Bind(wx.EVT_TOOLBOOK_PAGE_CHANGED, self.OnPageChanged)
self.Bind(wx.EVT_TOOLBOOK_PAGE_CHANGING, self.OnPageChanging)

self.grid_sizer_1.Add(self.note, 0, wx.EXPAND, 20)
self.grid_sizer_1.Add(self.labelDnD, 0, wx.TOP|
wx.ALIGN_CENTER_HORIZONTAL,20)
self.grid_sizer_2.Add(self.keyBitmap, 0, wx.LEFT,10)
self.grid_sizer_2.Add(self.labelDnD, 0, wx.LEFT, 20)
self.grid_sizer_1.Add(self.grid_sizer_2, 0, wx.EXPAND, 20)
self.grid_sizer_1.Add(self.conclude, 0, wx.TOP|
wx.ALIGN_CENTER_HORIZONTAL, 20)

self.SetSizer(self.grid_sizer_1)
self.grid_sizer_1.Fit(self)
self.Layout()
# end wxGlade

def OnPageChanged(self, event):
event.Skip()

def OnPageChanging(self, event):
event.Skip()
=========================================

Is this still a problem?

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423




This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
 
M

Mel

I've created a wx NoteBook in wich I set multiples panels in wich I
set one or more sizers. But nothing displays in the notebook,
everything is outside. I've been searching an answer for 2 days ><.
Can you help me plz ? Here is my code(with only one panel, to sum up
the code) :

class StreamingActivationDialog(wx.Dialog):
def __init__(self, *args, **kwds):
# begin wxGlade: StreamingActivationDialog.__init__
kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, *args, **kwds)
self.bitmap_1_copy = wx.StaticBitmap(self, -1, wx.Bitmap("img\
\logo.png", wx.BITMAP_TYPE_ANY))
self.labelDnD = wx.StaticText(self, -1, "Si vous avez déjà un
fichier d'activation, faite le glisser dans cette fenetre")
self.keyBitmap = wx.StaticBitmap(self, -1, wx.Bitmap("img\
\key.bmp", wx.BITMAP_TYPE_ANY))
self.conclude = wx.StaticText(self, -1, _("test"),
style=wx.ALIGN_CENTRE)

### Panel ###
self.intro3_label = wx.StaticText(self, -1, "Envoyez un mail à
\[email protected]\ncontenant le code :",style=wx.ALIGN_CENTRE)
self.activationCode_label= wx.StaticText(self, -1,
"123456789", style=wx.TE_READONLY)
self.copy2_Button = wx.Button(self, -1, "Copier dans le presse-
papier")
self.copy2_Button.Bind(wx.EVT_BUTTON, PanelMail.onCopy)
##############

self.note = wx.Notebook(self, wx.ID_ANY, style=wx.BK_LEFT,
size=wx.Size(100, 341))
self.page3 = wx.Panel(self.note)

imagelist = wx.ImageList(94, 94)
bitmap1 = wx.Bitmap("img\\a.bmp", wx.BITMAP_TYPE_BMP )
imagelist.Add(bitmap1)
self.note.AssignImageList(imagelist)

self.__set_properties()
self.__do_layout()
# end wxGlade

def __set_properties(self):
# begin wxGlade: StreamingActivationDialog.__set_properties
self.SetTitle(_("Activation de FlashProcess"))
self.SetBackgroundColour(wx.Colour(255, 255, 255))
#self.linkProblem.SetForegroundColour(wx.Colour(0, 0, 0))
# end wxGlade

def __do_layout(self):
# begin wxGlade: StreamingActivationDialog.__do_layout
self.grid_sizer_1 = wx.FlexGridSizer(6, 1, 0, 0)
self.grid_sizer_2 = wx.FlexGridSizer(1, 2, 0, 30)
self.grid_sizer_1.Add(self.bitmap_1_copy, 0, wx.TOP|wx.BOTTOM|
wx.EXPAND, 10)


### Page 3 ###
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.intro3_label, 0, wx.BOTTOM|wx.ALIGN_CENTER, 5)
sizer.Add(self.activationCode_label, 0, wx.BOTTOM|
wx.ALIGN_CENTER, 20)
sizer.Add(self.copy2_Button, 0, wx.ALIGN_CENTER, 20)

self.page3.SetSizer(sizer)
sizer.Fit(self.page3)
##############

self.note.AddPage(self.page3, "", False, 0)
[ ... ]

It looks a though all the controls that are meant for page3 have been
created with the top-level dialog as their parent. AFAIK this cannot be.
self.page3 is (correctly) a child window of self.note, but the controls to
be shown inside have to be children of self.page3 . Putting things into the
sizers is not enough.

In my own code, I usually define a separate class descended from wx.Panel to
create a page3 instance with its own sizers, then create one of those with a
a wx.Notebook instance as a parent, and add it to the notebook:

def _new_capture_page (self):
new_trace = TraceWindow (self.tracebook)
self.tracebook.AddPage (new_trace, 'Capture %d' %
(self.capture_serial,), select=True)
return new_trace


Hope this helps,

Mel.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top