[wxPython] two Panels OK - one NOT

may be an newbiequestion:

why one Panel in a Frame doesn't work?

app.runOK shows a blue and a red panel on 800x600 Frame
app.runNotOK shows a blue 800x600 Frame

any help?

thanks in advance
Manfred

###### test1.py

from wxPython.wx import *

class myApp(wxPySimpleApp):

# doesn't run with subpanelB or subpanelR alone
def runOK (self):
   mframe = wxFrame(None,-1,"Test",size=(800,600))
   subpanelB = wxPanel(mframe,-1,size=(400,200),pos=(50,10))
   subpanelB.SetBackgroundColour('blue')

   subpanelR = wxPanel(mframe,-1,size=(400,200),pos=(50,300))
   subpanelR.SetBackgroundColour('red')
   mframe.Show()

···

#
def runNotOK (self):
   mframe = wxFrame(None,-1,"Test",size=(800,600))
   subpanelB = wxPanel(mframe,-1,size=(400,200),pos=(50,10))
   subpanelB.SetBackgroundColour('blue')
   mframe.Show()

if __name__=="__main__":
    app = myApp()
    app.runOK()
    #app.runNotOK()
    app.MainLoop()

Both your test examples (runOK and runNotOK) ran fine on my
(wxGTK/wxPython) system.

However, one very illogical thing, I find, is that if you put just one
panel in a window, it is always automatically resized to fit the parent
window (even if I explicitly try to set the size with a panel.SetSize()
call and set parent.SetAtuoLayout(false)!). Thus your RunNotOK example
created a blue panel which filled the entire frame, no matter what.

Comments anyone?

Bryan

···

On Wed, 2002-04-10 at 08:23, M. Nowak wrote:

may be an newbiequestion:

why one Panel in a Frame doesn't work?

app.runOK shows a blue and a red panel on 800x600 Frame
app.runNotOK shows a blue 800x600 Frame

any help?

thanks in advance
Manfred

###### test1.py

from wxPython.wx import *

class myApp(wxPySimpleApp):

# doesn't run with subpanelB or subpanelR alone
def runOK (self):
   mframe = wxFrame(None,-1,"Test",size=(800,600))
   subpanelB = wxPanel(mframe,-1,size=(400,200),pos=(50,10))
   subpanelB.SetBackgroundColour('blue')

   subpanelR = wxPanel(mframe,-1,size=(400,200),pos=(50,300))
   subpanelR.SetBackgroundColour('red')
   mframe.Show()

#
def runNotOK (self):
   mframe = wxFrame(None,-1,"Test",size=(800,600))
   subpanelB = wxPanel(mframe,-1,size=(400,200),pos=(50,10))
   subpanelB.SetBackgroundColour('blue')
   mframe.Show()

if __name__=="__main__":
    app = myApp()
    app.runOK()
    #app.runNotOK()
    app.MainLoop()

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

--
Bryan Cole
Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge
CB4 0WG, United Kingdom.
tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382

Both your test examples (runOK and runNotOK) ran fine on my
(wxGTK/wxPython) system.

However, one very illogical thing, I find, is that if you put just one
panel in a window, it is always automatically resized to fit the parent
window (even if I explicitly try to set the size with a panel.SetSize()
call and set parent.SetAtuoLayout(false)!). Thus your RunNotOK example
created a blue panel which filled the entire frame, no matter what.

Comments anyone?

See #1 at http://wiki.wxpython.org/index.cgi/UsingSizers

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

So what do you do if you **don't** want the single child-window to be
resized? Can you turn off this default behavior?

Bryan

···

On Wed, 2002-04-10 at 17:34, Robin Dunn wrote:

> Both your test examples (runOK and runNotOK) ran fine on my
> (wxGTK/wxPython) system.
>
> However, one very illogical thing, I find, is that if you put just one
> panel in a window, it is always automatically resized to fit the parent
> window (even if I explicitly try to set the size with a panel.SetSize()
> call and set parent.SetAtuoLayout(false)!). Thus your RunNotOK example
> created a blue panel which filled the entire frame, no matter what.
>
> Comments anyone?

See #1 at http://wiki.wxpython.org/index.cgi/UsingSizers

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users

--
Bryan Cole
Teraview Ltd., 302-304 Cambridge Science Park, Milton Road, Cambridge
CB4 0WG, United Kingdom.
tel: +44 (1223) 435380 / 435386 (direct-dial) fax: +44 (1223) 435382

So what do you do if you **don't** want the single child-window to be
resized? Can you turn off this default behavior?

Yep. Just use EVT_SIZE and resize the child however you want in the event
handler.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!