# show a button with all default values
self.colourDefaults = csel.ColourSelect(self, -1)
- self.colourDefaults.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour, self.colourDefaults.GetId())
+ self.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour, id=self.colourDefaults.GetId())
buttonSizer.AddMany([
(wx.StaticText(self, -1, "Default Colour/Size"), 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL),
cBtnText.SetHelpText("Some helpful text...")
s = wx.BoxSizer(wx.HORIZONTAL)
- s.Add(cBtn, 0, wxALL, 5)
- s.Add(cBtnText, 0, wxALL, 5)
+ s.Add(cBtn, 0, wx.ALL, 5)
+ s.Add(cBtnText, 0, wx.ALL, 5)
sizer.Add((20,20))
sizer.Add(s)
rbox.Add(rb1)
rbox.Add(rb2)
- box.Add(text1, 0, wxALL, 10)
- box.Add(rbox, 0, wxALIGN_CENTER)
+ box.Add(text1, 0, wx.ALL, 10)
+ box.Add(rbox, 0, wx.ALIGN_CENTER)
box.Add((10,90))
- box.Add(text2, 0, wxALL, 10)
+ box.Add(text2, 0, wx.ALL, 10)
sizer.Add(box)
colors = []
for i in range(num):
- c = whrandom.choice(colours)
- colors.append(wxNamedColour(c))
+ c = random.choice(colours)
+ colors.append(wx.NamedColour(c))
return colors
message2 = wx.StaticText(self, -1, txt)
message2.SetFont(f1)
- targetPanel = Tile(self, log, bgColor=wxColour(80,10,10), active=0)
- buttonPanel = wxPanel(self ,-1)
- sizer = wxBoxSizer(wxHORIZONTAL)
+ targetPanel = Tile(self, log, bgColor=wx.Colour(80,10,10), active=0)
+ buttonPanel = wx.Panel(self ,-1)
+ sizer = wx.BoxSizer(wx.HORIZONTAL)
target = targetPanel.tile
sizer.Add((0,0), 1)
for factor in [0.2, 0.3, 0.4, 0.5, 0.6, 0.7]:
- sizer.Add(Tile(buttonPanel, log, factor-0.05, target), 0, wxALIGN_CENTER)
+ sizer.Add(Tile(buttonPanel, log, factor-0.05, target), 0, wx.ALIGN_CENTER)
sizer.Add((0,0),1)
- sizer.Add(Tile(buttonPanel, log, factor, target), 0, wxALIGN_CENTER)
+ sizer.Add(Tile(buttonPanel, log, factor, target), 0, wx.ALIGN_CENTER)
sizer.Add((0,0),1)
buttonPanel.SetAutoLayout(1)
-class InnerTile(wxPanel):
+class InnerTile(wx.Panel):
IDLE_COLOR = wx.Colour( 80, 10, 10)
START_COLOR = wx.Colour(200, 70, 50)
FINAL_COLOR = wx.Colour( 20, 80,240)
gridlib.PyGridTableBase.__init__(self)
self.log = log
- self.odd=wxGridCellAttr()
+ self.odd=gridlib.GridCellAttr()
self.odd.SetBackgroundColour("sky blue")
- self.even=wxGridCellAttr()
+ self.even=gridlib.GridCellAttr()
self.even.SetBackgroundColour("sea green")
def GetAttr(self, row, col, kind):
gridlib.PyGridCellRenderer.__init__(self)
def Draw(self, grid, attr, dc, rect, row, col, isSelected):
- dc.SetBackgroundMode(wxSOLID)
- dc.SetBrush(wxBrush(wxBLACK, wxSOLID))
- dc.SetPen(wxTRANSPARENT_PEN)
+ dc.SetBackgroundMode(wx.SOLID)
+ dc.SetBrush(wx.Brush(wx.BLACK, wx.SOLID))
+ dc.SetPen(wx.TRANSPARENT_PEN)
dc.DrawRectangleRect(rect)
dc.SetBackgroundMode(wx.TRANSPARENT)
wx.Panel.__init__(self, parent, -1)
self.SetAutoLayout(True)
- self.Bind(EVT_BUTTON, self.OnButton, id=ID_Button)
+ self.Bind(wx.EVT_BUTTON, self.OnButton, id=ID_Button)
self.panelA = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
self.panelA.SetBackgroundColour(wx.BLUE)
text.SetFont(wx.Font(24, wx.SWISS, wx.NORMAL, wx.BOLD, False))
text.SetLabel(msg)
w,h = text.GetTextExtent(msg)
- text.SetSize(wxSize(w,h+1))
- text.SetForegroundColour(wxBLUE)
- outsideSizer.Add(text, 0, wxEXPAND|wxALL, 5)
- outsideSizer.Add(wxStaticLine(self, -1), 0, wxEXPAND)
+ text.SetSize(wx.Size(w,h+1))
+ text.SetForegroundColour(wx.BLUE)
+ outsideSizer.Add(text, 0, wx.EXPAND|wx.ALL, 5)
+ outsideSizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND)
outsideSizer.Add((20,20))
self.SetFont(wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False))
inSizer.Add((20,20))
inSizer.Add((20,20))
- inSizer.Add(wxStaticText(self, -1,
+ inSizer.Add(wx.StaticText(self, -1,
"Drag URLs from your browser to\nthis window:",
style = wx.ALIGN_RIGHT),
0, wx.ALIGN_RIGHT )
self.Bind(wx.EVT_COMBOBOX, self.OnSelectID, combo)
combo.Select(0)
- cb = wxCheckBox(self, -1, "Use custom provider")
+ cb = wx.CheckBox(self, -1, "Use custom provider")
fgs.Add(cb, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
- self.Bind(EVT_CHECKBOX, self.OnUseCustom, cb)
+ self.Bind(wx.EVT_CHECKBOX, self.OnUseCustom, cb)
fgs.Add((10, 10), 0, wx.ALIGN_CENTRE|wx.ALL, 5)
fgs.Add((10, 10), 0, wx.ALIGN_CENTRE|wx.ALL, 5)
self.log = log
b = wx.Button(self, 10, "Default Button", (20, 20))
- self.Bind(EVT_BUTTON, self.OnClick, b)
+ self.Bind(wx.EVT_BUTTON, self.OnClick, b)
b.SetDefault()
b.SetSize(b.GetBestSize())
b = wx.Button(self, 20, "HELLO AGAIN!", (20, 80), (120, 45))
- self.Bind(EVT_BUTTON, self.OnClick, b)
+ self.Bind(wx.EVT_BUTTON, self.OnClick, b)
b.SetToolTipString("This is a Hello button...")
if 0: # a test case for catching wx.PyAssertionError
memDC = wx.MemoryDC()
memDC.SelectObject(self.bmp)
- dc.Blit((self.pos.x, self.pos.y),
+ dc.Blit((self.pos[0], self.pos[1]),
(self.bmp.GetWidth(), self.bmp.GetHeight()),
memDC, (0, 0), op, True)
dc.SetTextForeground(wx.RED)
dc.SetFont(font)
dc.DrawText(text, (0, 0))
- dc.SelectObject(wxNullBitmap)
- mask = wxMaskColour(bmp, bg_colour)
+ dc.SelectObject(wx.NullBitmap)
+ mask = wx.MaskColour(bmp, bg_colour)
bmp.SetMask(mask)
shape = DragShape(bmp)
shape.pos = (5, 100)
elif not haveOpenGL:
def runTest(frame, nb, log):
- dlg = wxMessageDialog(
+ dlg = wx.MessageDialog(
frame, 'The OpenGL package was not found. You can get it at\n'
'http://PyOpenGL.sourceforge.net/', 'Sorry', wx.OK | wx.ICON_INFORMATION
)
wx.Panel.__init__(self, parent, -1)
self.log = log
- box = wxBoxSizer(wx.VERTICAL)
+ box = wx.BoxSizer(wx.VERTICAL)
box.Add((20, 20))
keys = buttonDefs.keys()
keys.sort()
dc.SetBrush(wx.Brush(wx.BLUE, wx.SOLID))
dc.SetPen(wx.Pen(wx.BLUE, 1, wx.SOLID))
else:
- dc.SetBrush(wxBrush(wxWHITE, wxSOLID))
- dc.SetPen(wxPen(wxWHITE, 1, wxSOLID))
+ dc.SetBrush(wx.Brush(wx.WHITE, wx.SOLID))
+ dc.SetPen(wx.Pen(wx.WHITE, 1, wx.SOLID))
dc.DrawRectangleRect(rect)
#dc.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))
dc.Blit((rect.x+1, rect.y+1), (width, height),
image,
- (0, 0), wxCOPY, True)
+ (0, 0), wx.COPY, True)
class MegaFontRenderer(Grid.PyGridCellRenderer):
dc.SetBrush(wx.Brush(wx.BLUE, wx.SOLID))
dc.SetPen(wx.Pen(wx.BLUE, 1, wx.SOLID))
else:
- dc.SetBrush(wxBrush(wxWHITE, wxSOLID))
- dc.SetPen(wxPen(wxWHITE, 1, wxSOLID))
+ dc.SetBrush(wx.Brush(wx.WHITE, wx.SOLID))
+ dc.SetPen(wx.Pen(wx.WHITE, 1, wx.SOLID))
dc.DrawRectangleRect(rect)
#dc.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))
import wx
+import images
+
+import ColorPanel
+
colourList = [ "Aquamarine", "Black", "Blue", "Blue Violet", "Brown", "Cadet Blue",
"Coral", "Cornflower Blue", "Cyan", "Dark Grey", "Dark Green",
"Dark Olive Green", "Dark Orchid", "Dark Slate Blue",
# make an image list using the BlomXX images
- il = wxImageList(32, 32)
+ il = wx.ImageList(32, 32)
for x in range(1, 15):
f = getattr(images, 'getBlom%02dBitmap' % x)
bmp = f()
imID += 1
if imID == il.GetImageCount(): imID = 0
if first:
- st = wxStaticText(win.win, -1,
+ st = wx.StaticText(win.win, -1,
"You can put nearly any type of window here,\n"
"and the list can be on any side of the Listbook",
- wxPoint(10, 10))
+ wx.Point(10, 10))
#st.SetForegroundColour(wxWHITE)
#st.SetBackgroundColour(wxBLUE)
first = False
- EVT_LISTBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
- EVT_LISTBOOK_PAGE_CHANGING(self, self.GetId(), self.OnPageChanging)
+ wx.EVT_LISTBOOK_PAGE_CHANGED(self, self.GetId(), self.OnPageChanged)
+ wx.EVT_LISTBOOK_PAGE_CHANGING(self, self.GetId(), self.OnPageChanging)
def makeColorPanel(self, color):
# This creates some pens and brushes that the OGL library uses.
# It should be called after the app object has been created, but
# before OGL is used.
- wx.OGLInitialize()
+ ogl.OGLInitialize()
win = TestWindow(nb, log, frame)
return win
panel3.SetAutoLayout(1)
panel3.SetupScrolling()
- hbox = wxBoxSizer(wxHORIZONTAL)
+ hbox = wx.BoxSizer(wx.HORIZONTAL)
hbox.Add((20,20))
hbox.Add(panel1, 0)
hbox.Add((40, 10))
#---------------------------------------------------------------------------
class MyCanvas(wx.ScrolledWindow):
- def __init__(self, parent, id = -1):
+ def __init__(self, parent, id = -1, size = wx.DefaultSize):
wx.ScrolledWindow.__init__(self, parent, id, (0, 0), size=size, style=wx.SUNKEN_BORDER)
self.lines = []
elif self.fold_symbols == 1:
# Plus for contracted folders, minus for expanded
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_MINUS, "white", "black");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_PLUS, "white", "black");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_EMPTY, "white", "black");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_EMPTY, "white", "black");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_EMPTY, "white", "black");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_EMPTY, "white", "black");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_EMPTY, "white", "black");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_MINUS, "white", "black");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_PLUS, "white", "black");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_EMPTY, "white", "black");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_EMPTY, "white", "black");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_EMPTY, "white", "black");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_EMPTY, "white", "black");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_EMPTY, "white", "black");
elif self.fold_symbols == 2:
# Like a flattened tree control using circular headers and curved joins
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_CIRCLEMINUS, "white", "#404040");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_CIRCLEPLUS, "white", "#404040");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, "white", "#404040");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNERCURVE, "white", "#404040");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_CIRCLEPLUSCONNECTED, "white", "#404040");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040");
- self.MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNERCURVE, "white", "#404040");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_CIRCLEMINUS, "white", "#404040");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_CIRCLEPLUS, "white", "#404040");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE, "white", "#404040");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNERCURVE, "white", "#404040");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_CIRCLEPLUSCONNECTED, "white", "#404040");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_CIRCLEMINUSCONNECTED, "white", "#404040");
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNERCURVE, "white", "#404040");
elif self.fold_symbols == 3:
# Like a flattened tree control using square headers
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPEN, wxSTC_MARK_BOXMINUS, "white", "#808080")
- self.MarkerDefine(wxSTC_MARKNUM_FOLDER, wxSTC_MARK_BOXPLUS, "white", "#808080")
- self.MarkerDefine(wxSTC_MARKNUM_FOLDERSUB, wxSTC_MARK_VLINE, "white", "#808080")
- self.MarkerDefine(wxSTC_MARKNUM_FOLDERTAIL, wxSTC_MARK_LCORNER, "white", "#808080")
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEREND, wxSTC_MARK_BOXPLUSCONNECTED, "white", "#808080")
- self.MarkerDefine(wxSTC_MARKNUM_FOLDEROPENMID, wxSTC_MARK_BOXMINUSCONNECTED, "white", "#808080")
- self.MarkerDefine(wxSTC_MARKNUM_FOLDERMIDTAIL, wxSTC_MARK_TCORNER, "white", "#808080")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_BOXMINUS, "white", "#808080")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_BOXPLUS, "white", "#808080")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE, "white", "#808080")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNER, "white", "#808080")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_BOXPLUSCONNECTED, "white", "#808080")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "#808080")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER, "white", "#808080")
self.Bind(stc.EVT_STC_UPDATEUI, self.OnUpdateUI)
fgs = wx.FlexGridSizer(0, 2)
fgs.Add((1,1))
- fgs.Add(wxStaticText(self, -1, "These controls have validators that limit\n"
+ fgs.Add(wx.StaticText(self, -1, "These controls have validators that limit\n"
"the type of characters that can be entered."))
fgs.Add((1,VSPACE)); fgs.Add((1,VSPACE))
fgs.Add((1,VSPACE)); fgs.Add((1,VSPACE))
label = wx.StaticText(self, -1, "Digits Only: ")
- fgs.Add(label, 0, wx.ALIGN_RIGHT|wxCENTER)
+ fgs.Add(label, 0, wx.ALIGN_RIGHT|wx.CENTER)
fgs.Add(wx.TextCtrl(self, -1, "", validator = MyValidator(DIGIT_ONLY)))
fgs.Add((1,VSPACE)); fgs.Add((1,VSPACE))
fgs.Add((1,VSPACE)); fgs.Add((1,VSPACE))
fgs.Add((0,0))
b = wx.Button(self, -1, "Test Dialog Validation")
- self.Bind(EVT_BUTTON, self.OnDoDialog, b)
+ self.Bind(wx.EVT_BUTTON, self.OnDoDialog, b)
fgs.Add(b)
border = wx.BoxSizer()
fgs = wx.FlexGridSizer(0, 2)
fgs.Add((1,1));
- fgs.Add(wxStaticText(self, -1,
+ fgs.Add(wx.StaticText(self, -1,
"These controls must have text entered into them. Each\n"
"one has a validator that is checked when the Okay\n"
"button is clicked."))