Python classes
Panel |
wx.Python |
Frame |
wx.Frame |
Text |
wx.StaticText |
Input field |
wx.TextCtrl |
Vertical box |
wx.BoxSizer(wx.VERTICAL) |
Horizontal box |
wx.BoxSizer(wx.HORIZONTAL) |
Maak box
def maakBoxje(self, getal):
tekstpaneel = wx.StaticText(self, -1, getal)
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add(tekstpaneel, 1, updown)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(hbox, 1, leftright)
return vbox
|
Centreer box
def centreer(self, paneel):
hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add(paneel, 1, wx.CENTER)
vbox = wx.BoxSizer(wx.VERTICAL)
vbox.Add(hbox, 1, wx.CENTER)
return vbox
|
Boxes
Add panel to box |
box.Add(panel, ratio, wx.EXPAND) |
Add text to box |
box.Add(wx.StaticText(self, -1, "text"), 1, wx.EXPAND) |
Left |
wx.ALIGN_LEFT |
Right |
wx.ALIGN_RIGHT |
Top |
wx.ALIGN_TOP |
Bottom |
wx.ALIGN_BOTTOM |
Set box |
self.SetSizer(box) |
Buttons
Button |
wx.Button(self, id, namebutton) |
wx.EVT_BUTTON |
self.namebutton.GetEventObject().GetValue() |
Toggle Button |
wx.ToggleButton(self, id, namebutton) |
wx.EVT_TOGGLEBUTTON |
self.namebutton.GetValue() |
Radiobox Button |
wx.RadioBox |
- |
self.namebutton.GetSelection() |
Spin Button |
wx.SpinButton(self, -1) |
wx.EVT_SPIN |
self.event.GetPosition() |
Frame
Hide, Maximize, Minimize button |
wx.Frame.__init__(self, parent, id, title, size=(307,289), style = wx.CLOSE_BOX|wx.SYSTEM_MENU | wx.CAPTION | wx.CLIP_CHILDREN | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX)
|
Resize NOT |
style = wx.DEFAULT_FRAME_STYLE &(~wx.RESIZE_BORDER) |
Position |
self.SetPosition(length, width) |
Put in center |
self.Centre() |
StaticText
Font |
font = wx.Font(60, wx.DECORATIVE, wx.ITALIC, wx.BOLD)
|
font.MakeBold().MakeItalic().MakeUnderlined()
|
font.SetPointSize(pointsize)
|
Use font |
text.SetFont(font) |
Panels
Background colour |
panel.SetBackgroundColour(wx.RED) |
|