wxpython - wx.Panel scales to fit entire parent Frame despite giving it a size -


I'm a newbie for Wxpython. I am trying to create a frame and there is a small panel area inside that I am blue. However, no one matters what I do. Using panil-shaped properties, the single panel pulls the size of its original frame. If I add another panel (Pen 2 in the code below) both the pens are drawn in the right size.

I know that I can control these panels using Sears. But I was trying to understand why the wx.Panel behaves the way the object behaves all alone.

Here is the code:

import wx

  class plateau (wx.frame): def __init __ (auto, * args, ** kwds ): Self.frame = wx.frame .__ init __ (auto, * args, ** kwds) print "made frame" if __name__ == "__main__": an_app = wx.PySimpleApp () aframe = PlateGui (original = any No, id = -1, title = "test frame", size = (300, 300)) pane = wx.panel (parent = aframe, size = (100,100), style = wx.RAISED_BORDER) Set-Background Caller (wx.Colour (0,0,255)) # Pence 2 = wx.Panel (Original = Ephraim, Size = (200,100), style = wx.RAISED_BORDER) Commenting outside the second panel, the first pane is full size Focused on the frame without mentioning Ephraim. Show () an_app.MainLoop ()  

By default, one in wx.frame Size that spreads to fill your child's frame. To create your own shape, set the panel to it (with no extension of the flag) and set it as the frame size.

  import wx app = wx.PySimpleApp () frame = wx.Frame (None, -1, 'test') sizer = wx.boxSizer (wx.VERTICAL) panel = wx.panel ( Frame, -1, size = (100,100), style = wx.bordER_RAISED) sizer.Add (panel) frame.SetSizer frame.Show () app.MainLoop ()  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -