Maximize panel

I want to maximize a panel, which is run from one event bind, to maximize the frame is not maximize the panel.

My code:
self.panel = wx.Panel(self, -1)
self.Bind(wx.EVT_TOOL, self.OnText, id = ID_TEXT)

def OnText(self, evt):
self.panel = Text(self, -1)
self.panel.Show()

Any suggestions?

···


SIN ETIQUETAS.[ PUNTO ]
http://jyr.tumblr.com
http://www.opentumblr.com

Hi, I do not quite understand what you want to do, Do you want to make

the panel fill the size of the frame? Are you using sizers?

Che

···

On Fri, Aug 14, 2009 at 1:22 AM, Jair Gaxiola jyr.gaxiola@gmail.com wrote:

I want to maximize a panel, which is run from one event bind, to maximize the frame is not maximize the panel.

My code:
self.panel = wx.Panel(self, -1)
self.Bind(wx.EVT_TOOL, self.OnText, id = ID_TEXT)


def OnText(self, evt):
self.panel = Text(self, -1)
self.panel.Show()

Any suggestions?

Yes,

The panel is the same size as the frame without maximize,when maximizes the frame the panel is not maximized together with the frame, attached a image

···

On Fri, Aug 14, 2009 at 3:03 AM, C M cmpython@gmail.com wrote:

On Fri, Aug 14, 2009 at 1:22 AM, Jair Gaxiola jyr.gaxiola@gmail.com wrote:

I want to maximize a panel, which is run from one event bind, to maximize the frame is not maximize the panel.

My code:
self.panel = wx.Panel(self, -1)
self.Bind(wx.EVT_TOOL, self.OnText, id = ID_TEXT)


def OnText(self, evt):
self.panel = Text(self, -1)
self.panel.Show()

Any suggestions?

Hi, I do not quite understand what you want to do, Do you want to make

the panel fill the size of the frame? Are you using sizers?


SIN ETIQUETAS.[ PUNTO ]
http://jyr.tumblr.com
http://www.opentumblr.com

Hello,

I want to maximize a panel, which is run from one event bind, to maximize
the frame is not maximize the panel.

My code:
self.panel = wx.Panel(self, -1)
self.Bind(wx.EVT_TOOL, self.OnText, id = ID_TEXT)
...
def OnText(self, evt):
self.panel = Text(self, -1)
self.panel.Show()

Any suggestions?

Hi, I do not quite understand what you want to do, Do you want to make
the panel fill the size of the frame? Are you using sizers?

Yes,

The panel is the same size as the frame without maximize,when maximizes the
frame the panel is not maximized together with the frame, attached a image

You can't simply just reassign the 'self.panel' attribute and expect
it to swap out the layout in your frame with the item that was
previously assigned to self.panel as that object still exists in the
layout and the new item will just be put at 0,0 with its default size.

You should set up your frame as follows

Frame
   >
  +- Main Panel
         >
         + SubPanel1 (Text)

The Main Panel can be used to control what one of your sub panels is
shown at any given time. Here are a couple ways to do it.

* Use a Sizer and swap the items out when changing to a new one, using
the EXPAND flag when adding it to the sizer.

* Use a book control for the main panel and switch what page is
selected (there is a ToolBook class that will take care of your
toolbar too (though its a generic control and doesn't look very good
on wxMac).

Cody

···

On Fri, Aug 14, 2009 at 10:24 AM, Jair Gaxiola<jyr.gaxiola@gmail.com> wrote:

On Fri, Aug 14, 2009 at 3:03 AM, C M <cmpython@gmail.com> wrote:

On Fri, Aug 14, 2009 at 1:22 AM, Jair Gaxiola <jyr.gaxiola@gmail.com> >> wrote:

Jair,

>> I want to maximize a panel, which is run from one event bind, to maximize
>> the frame is not maximize the panel.

>> My code:
>> self.panel = wx.Panel(self, -1)
>> self.Bind(wx.EVT_TOOL, self.OnText, id = ID_TEXT)
>> ...
>> def OnText(self, evt):
>> self.panel = Text(self, -1)
>> self.panel.Show()

>> Any suggestions?

> Hi, I do not quite understand what you want to do, Do you want to make
> the panel fill the size of the frame? Are you using sizers?

Yes,

The panel is the same size as the frame without maximize,when maximizes the
frame the panel is not maximized together with the frame, attached a image

--

Che is correct. You need to put the panel in a sizer. Something like
this:

sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.panel, 1, wx.EXPAND)
self.SetSizer(sizer)

That (or something like it) should work.

- Mike

···

On Aug 14, 10:24 am, Jair Gaxiola <jyr.gaxi...@gmail.com> wrote:

On Fri, Aug 14, 2009 at 3:03 AM, C M <cmpyt...@gmail.com> wrote:
> On Fri, Aug 14, 2009 at 1:22 AM, Jair Gaxiola <jyr.gaxi...@gmail.com>wrote:

Mike

dashboard.py (6.92 KB)

···

On Fri, Aug 14, 2009 at 10:39 AM, Mike Driscoll kyosohma@gmail.com wrote:

Jair,

On Aug 14, 10:24 am, Jair Gaxiola jyr.gaxi...@gmail.com wrote:

On Fri, Aug 14, 2009 at 3:03 AM, C M cmpyt...@gmail.com wrote:

On Fri, Aug 14, 2009 at 1:22 AM, Jair Gaxiola jyr.gaxi...@gmail.comwrote:

I want to maximize a panel, which is run from one event bind, to maximize

the frame is not maximize the panel.

My code:

    self.panel = wx.Panel(self, -1)
    self.Bind(wx.EVT_TOOL, self.OnText, id = ID_TEXT)

def OnText(self, evt):
    self.panel = Text(self, -1)
    self.panel.Show()

Any suggestions?

Hi, I do not quite understand what you want to do, Do you want to make

the panel fill the size of the frame? Are you using sizers?

Yes,

The panel is the same size as the frame without maximize,when maximizes the

frame the panel is not maximized together with the frame, attached a image

Che is correct. You need to put the panel in a sizer. Something like

this:

sizer = wx.BoxSizer(wx.VERTICAL)

sizer.Add(self.panel, 1, wx.EXPAND)

self.SetSizer(sizer)

That (or something like it) should work.

I have this in code, but are not maximizing the panel together with the frame, attached my code


SIN ETIQUETAS.[ PUNTO ]

http://jyr.tumblr.com
http://www.opentumblr.com

Cody,

···

On Fri, Aug 14, 2009 at 10:38 AM, Cody Precord codyprecord@gmail.com wrote:

Hello,

On Fri, Aug 14, 2009 at 10:24 AM, Jair Gaxiolajyr.gaxiola@gmail.com wrote:

On Fri, Aug 14, 2009 at 3:03 AM, C M cmpython@gmail.com wrote:

On Fri, Aug 14, 2009 at 1:22 AM, Jair Gaxiola jyr.gaxiola@gmail.com > > >> wrote:

I want to maximize a panel, which is run from one event bind, to maximize

the frame is not maximize the panel.

My code:

    self.panel = wx.Panel(self, -1)
    self.Bind(wx.EVT_TOOL, self.OnText, id = ID_TEXT)

def OnText(self, evt):
    self.panel = Text(self, -1)
    self.panel.Show()

Any suggestions?

Hi, I do not quite understand what you want to do, Do you want to make

the panel fill the size of the frame? Are you using sizers?

Yes,

The panel is the same size as the frame without maximize,when maximizes the

frame the panel is not maximized together with the frame, attached a image

You can’t simply just reassign the ‘self.panel’ attribute and expect

it to swap out the layout in your frame with the item that was

previously assigned to self.panel as that object still exists in the

layout and the new item will just be put at 0,0 with its default size.

You should set up your frame as follows

Frame

± Main Panel

     >

     + SubPanel1 (Text)

The Main Panel can be used to control what one of your sub panels is

shown at any given time. Here are a couple ways to do it.

  • Use a Sizer and swap the items out when changing to a new one, using

the EXPAND flag when adding it to the sizer.

  • Use a book control for the main panel and switch what page is

selected (there is a ToolBook class that will take care of your

toolbar too (though its a generic control and doesn’t look very good

on wxMac).

You have a example?


SIN ETIQUETAS.[ PUNTO ]
http://jyr.tumblr.com
http://www.opentumblr.com

I commented out all the code related to the toolbar since you didn’t include the icons. Anyway, it worked fine for me after I did that (as far as I can tell). I’m on Windows XP, Python 2.5, wxPython 2.8.10.1 (msw-unicode)

  • Mike

dashboard.py (6.97 KB)

···

On Fri, Aug 14, 2009 at 10:47 AM, Jair Gaxiola jyr.gaxiola@gmail.com wrote:

Mike

On Fri, Aug 14, 2009 at 10:39 AM, Mike Driscoll kyosohma@gmail.com wrote:

Jair,

On Aug 14, 10:24 am, Jair Gaxiola jyr.gaxi...@gmail.com wrote:

On Fri, Aug 14, 2009 at 3:03 AM, C M cmpyt...@gmail.com wrote:

On Fri, Aug 14, 2009 at 1:22 AM, Jair Gaxiola jyr.gaxi...@gmail.comwrote:

I want to maximize a panel, which is run from one event bind, to maximize

the frame is not maximize the panel.

My code:

    self.panel = wx.Panel(self, -1)
    self.Bind(wx.EVT_TOOL, self.OnText, id = ID_TEXT)

def OnText(self, evt):
    self.panel = Text(self, -1)
    self.panel.Show()

Any suggestions?

Hi, I do not quite understand what you want to do, Do you want to make

the panel fill the size of the frame? Are you using sizers?

Yes,

The panel is the same size as the frame without maximize,when maximizes the

frame the panel is not maximized together with the frame, attached a image

Che is correct. You need to put the panel in a sizer. Something like

this:

sizer = wx.BoxSizer(wx.VERTICAL)

sizer.Add(self.panel, 1, wx.EXPAND)

self.SetSizer(sizer)

That (or something like it) should work.

I have this in code, but are not maximizing the panel together with the frame, attached my code


Mike Driscoll

Blog: http://blog.pythonlibrary.org

Hello,

Cody,

You have a example?

No,

1) have you looked at the demo?

2) always try to create a minimal sample that reproduces the problem
to make it easier for others to help you.

3) I was a little bored so I spent the 3 minutes it took to make and
attach an example. The bill is in the mail :wink:

Cody

swap_panel.py (1.97 KB)

···

On Fri, Aug 14, 2009 at 10:51 AM, Jair Gaxiola<jyr.gaxiola@gmail.com> wrote:

Thanks a lot, the panel works

···

On Fri, Aug 14, 2009 at 11:11 AM, Cody Precord codyprecord@gmail.com wrote:

Hello,

On Fri, Aug 14, 2009 at 10:51 AM, Jair Gaxiolajyr.gaxiola@gmail.com wrote:

Cody,

You have a example?

No,

  1. have you looked at the demo?

  2. always try to create a minimal sample that reproduces the problem

to make it easier for others to help you.

  1. I was a little bored so I spent the 3 minutes it took to make and

attach an example. The bill is in the mail :wink:


SIN ETIQUETAS.[ PUNTO ]
http://jyr.tumblr.com

http://www.opentumblr.com