ImportWXclassForm (WX. Frame):def __init__(self,parent,id,title): WX. Frame.__init__(self,parent,id,title) panel= WX. Panel (self,-1) wx. Button (panel,-1,"Button1", (0,0)) wx. Button (panel,-1,"Button2", (80, 0)) Wx. Button (panel,-1,"Button3", (160, 0))classApp (WX. APP):defOnpreinit (self): form= Form (None,-1,"Panel Layout") Form. Show () Form. Centre () app=app () app. Mainloop ()
ImportWXclassMyFrame (WX. Frame):def __init__(self, parent, ID, title): WX. Frame.__init__(self, parent, ID, title) pnl1= WX. Panel (self,-1, style=WX. Simple_border) Pnl2= WX. Panel (self,-1, style=WX. Raised_border) Pnl3= WX. Panel (self,-1, style=WX. Sunken_border) Pnl4= WX. Panel (self,-1, style=WX. Double_border) Pnl5= WX. Panel (self,-1, style=WX. Static_border) Pnl6= WX. Panel (self,-1, style=Wx.no_border) Hbox1 = WX. Boxsizer (WX. Horizontal) Hbox1. ADD (PNL1,1, WX. EXPAND | Wx. All, 3) Hbox1. ADD (PNL2,1, WX. EXPAND | Wx. All, 3) Hbox1. ADD (PNL3,1, WX. EXPAND | Wx. All, 3) Hbox2 = WX. Boxsizer (WX. Horizontal) Hbox2. ADD (Pnl4,1, WX. EXPAND | Wx. All, 3) Hbox2. ADD (PNL5,1, WX. EXPAND | Wx. All, 3) Hbox2. ADD (PNL6,1, WX. EXPAND | Wx. All, 3) VBox =wx. Boxsizer (WX. VERTICAL) VBox. ADD (Hbox1, 1, WX. EXPAND) VBox. ADD (Hbox2, 1 , WX. EXPAND) self. Setsizer (VBox) self. Centre ()classMyApp (WX. APP):defOnInit (self): frame= MyFrame (None,-1,'borders.py') frame. Show (True)returnTrueapp=MyApp () app. Mainloop ()
Python experience (-pannel) and Sizer