</body></html>
"""
-# 11/24/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for 2.5
-#
-
import sys
import wx
</body></html>
"""
-# 11/24/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for V2.5
-#
-
import sys
import wx
-# 11/4/03 - grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o wx Namespace
-#
import wx
import wx.lib.analogclock as aclock
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import cStringIO
import wx
overview = """<html><body>
-<h2><center>wxArtProvider</center></h2>
+<h2><center>wx.ArtProvider</center></h2>
-wxArtProvider class can be used to customize the look of wxWindows
+wx.ArtProvider class can be used to customize the look of wxWindows
applications. When wxWindows internal classes need to display an icon
or a bitmap (e.g. in the standard file dialog), it does not use a
-hard-coded resource but asks wxArtProvider for it instead. This way
-the users can plug in their own wxArtProvider class and easily replace
+hard-coded resource but asks wx.ArtProvider for it instead. This way
+the users can plug in their own wx.ArtProvider class and easily replace
standard art with his/her own version. It is easy thing to do: all
-that is needed is to derive a class from wxArtProvider, override it's
+that is needed is to derive a class from wx.ArtProvider, override it's
CreateBitmap method and register the provider with
-wxArtProvider_PushProvider.
+wx.ArtProvider_PushProvider.
<p>
This class can also be used to get the platform native icons as
-provided by wxArtProvider_GetBitmap or wxArtProvider_GetIcon methods.
+provided by wx.ArtProvider_GetBitmap or wx.ArtProvider_GetIcon methods.
</body></html>
"""
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import images
mask = wx.MaskColour(bmp, wx.BLUE)
bmp.SetMask(mask)
- wx.BitmapButton(self, 30, bmp, (160, 20),
+ b = wx.BitmapButton(self, 30, bmp, (160, 20),
(bmp.GetWidth()+10, bmp.GetHeight()+10))
- self.Bind(wx.EVT_BUTTON, self.OnClick, id=30)
+ b.SetToolTipString("This is a bitmap button.")
+ self.Bind(wx.EVT_BUTTON, self.OnClick, b)
+
+
+ b = wx.Button(self, 40, "Flat Button", (20,150), style=wx.NO_BORDER)
+ b.SetToolTipString("This button has a style flag of wx.NO_BORDER")
+ self.Bind(wx.EVT_BUTTON, self.OnClick, b)
def OnClick(self, event):
#----------------------------------------------------------------------------
-# Name: wxCalendar.py
+# Name: Calendar.py
# Purpose: Calendar control display testing on panel for wxPython demo
#
# Author: Lorne White (email: lwhite1@planet.eon.net)
# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o Updated for wx namespace
-# o Some updating of the library itself will be needed for this demo to work
-# correctly.
#
# 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
-# o Problems have changed a little. The print dialog requires
-# a wx.Size to work with the calendar library. wx.core doesn't
-# approve, though, so we get deprecation warnings.
# o Ugh. AFter updating to the Bind() method, things lock up
# on various control clicks. Will have to debug. Only seems
# to happen on windows with calendar controls, though.
# o Lockup issue clarification: it appears that the spinner is
# the culprit.
#
-# 12/01/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o New Bind() method now fully supported.
-#
-# 12/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxCalendar renamed to Calendar
-# o Got rid of unneeded IDs where Bind() could figure it
-# out for itself.
-#
import os
self.font = wx.SWISS
self.bold = wx.NORMAL
- self.sel_key = None # last used by
+ self.sel_key = None # last used by
self.sel_lst = [] # highlighted selected days
self.size = None
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-import wx.lib.calendar as calendar
+import wx.calendar
#----------------------------------------------------------------------
wx.Panel.__init__(self, parent, ID)
self.log = log
- cal = calendar.CalendarCtrl(self, -1, wx.DateTime_Now(), pos = (25,50),
- style = calendar.CAL_SHOW_HOLIDAYS
- | calendar.CAL_SUNDAY_FIRST
- | calendar.CAL_SEQUENTIAL_MONTH_SELECTION
+ cal = wx.calendar.CalendarCtrl(self, -1, wx.DateTime_Now(), pos = (25,50),
+ style = wx.calendar.CAL_SHOW_HOLIDAYS
+ | wx.calendar.CAL_SUNDAY_FIRST
+ | wx.calendar.CAL_SEQUENTIAL_MONTH_SELECTION
)
- self.Bind(calendar.EVT_CALENDAR, self.OnCalSelected, id=cal.GetId())
+ self.Bind(wx.calendar.EVT_CALENDAR, self.OnCalSelected, id=cal.GetId())
b = wx.Button(self, -1, "Destroy the Calendar", pos = (250, 50))
self.Bind(wx.EVT_BUTTON, self.OnButton, id= b.GetId())
self.cal = cal
# Set up control to display a set of holidays:
- self.Bind(calendar.EVT_CALENDAR_MONTH, self.OnChangeMonth, id=cal.GetId())
+ self.Bind(wx.calendar.EVT_CALENDAR_MONTH, self.OnChangeMonth, cal)
self.holidays = [(1,1), (10,31), (12,25) ] # (these don't move around)
self.OnChangeMonth()
overview = """\
<html><body>
-<h2>wxCalendarCtrl</h2>
+<h2>CalendarCtrl</h2>
Yet <i>another</i> calendar control. This one is a wrapper around the C++
version described in the docs. This one will probably be a bit more efficient
"""
-
-
if __name__ == '__main__':
import sys,os
import run
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
wx.StaticText(self, -1, "This example uses the wxCheckBox control.", (10, 10))
- cID = wx.NewId()
- cb1 = wx.CheckBox(self, cID, " Apples", (65, 40), (150, 20), wx.NO_BORDER)
- cb2 = wx.CheckBox(self, cID+1, " Oranges", (65, 60), (150, 20), wx.NO_BORDER)
+ cb1 = wx.CheckBox(self, -1, " Apples", (65, 40), (150, 20), wx.NO_BORDER)
+ cb2 = wx.CheckBox(self, -1, " Oranges", (65, 60), (150, 20), wx.NO_BORDER)
cb2.SetValue(True)
- cb3 = wx.CheckBox(self, cID+2, " Pears", (65, 80), (150, 20), wx.NO_BORDER)
+ cb3 = wx.CheckBox(self, -1, " Pears", (65, 80), (150, 20), wx.NO_BORDER)
self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb1)
self.Bind(wx.EVT_CHECKBOX, self.EvtCheckBox, cb2)
#---------------------------------------------------------------------------
-
-
-
overview = """\
-A checkbox is a labelled box which is either on (checkmark is visible) or off (no checkmark).
+A checkbox is a labelled box which is either on (checkmark is visible) or off
+(no checkmark).
"""
-
+#---------------------------------------------------------------------------
if __name__ == '__main__':
import sys,os
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Why is there a popup menu in this demo?
-#
import wx
wx.StaticText(self, -1, "This example uses the wxCheckListBox control.", (45, 15))
- lb = wx.CheckListBox(self, 60, (80, 50), (80, 120), sampleList)
- self.Bind(wx.EVT_LISTBOX, self.EvtListBox, id=60)
- self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtListBoxDClick, id=60)
+ lb = wx.CheckListBox(self, -1, (80, 50), (80, 120), sampleList)
+ self.Bind(wx.EVT_LISTBOX, self.EvtListBox, lb)
+ self.Bind(wx.EVT_LISTBOX_DCLICK, self.EvtListBoxDClick, lb)
lb.SetSelection(0)
self.lb = lb
pos = lb.GetPosition().x + lb.GetSize().width + 25
btn = wx.Button(self, -1, "Test SetString", (pos, 50))
- self.Bind(wx.EVT_BUTTON, self.OnTestButton, id=btn.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnTestButton, btn)
self.Bind(wx.EVT_RIGHT_UP, self.OnDoPopup)
def EvtListBox(self, event):
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
"""
-
-
if __name__ == '__main__':
import sys,os
import run
-# 11/4/03 - grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Updated for wx namespace
#
# Note: this module is not a demo per se, but is used by many of
# the demo modules for various purposes.
+#
import wx
-# 11/4/03 - grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Updated to use wx namespace
-#
-# 11/24/03 - grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Had to move the call to wx.updateColourDB()
-# o Updated several places to change discrete pos and size parameters
-# into two-tuples.
-#
import wx
-import wx.lib.colourdb as cdb
+import wx.lib.colourdb
import images
wx.ScrolledWindow.__init__(self, parent, -1)
# Populate our color list
- self.clrList = cdb.getColourList()
+ self.clrList = wx.lib.colourdb.getColourList()
# Just for style points, we'll use this as a background image.
#self.clrList.sort()
# Note 11/24/03 - jg - I moved this into runTest() because
# there must be a wx.App existing before this function
# can be called - this is a change from 2.4 -> 2.5.
- cdb.updateColourDB()
+ wx.lib.colourdb.updateColourDB()
win = TestPanel(nb)
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
data selection pane. Otherwise, only the more compact and less extensive colour
dialog is shown. You may also preset the colour as well as other items.
-If the user selects something and selects OK, then the wxColourData instance contains
+If the user selects something and selects OK, then the wx.ColourData instance contains
the colour data that the user selected. Before destroying the dialog, retrieve the data.
<b>Do not try to retain the wx.ColourData instance.</b> It will probably not be valid
after the dialog is destroyed.
-Along with he wxColourDialog documentation, see also the wx.ColourData documentation
+Along with he wx.ColourDialog documentation, see also the wx.ColourData documentation
for details.
"""
# - use sizers
# - other minor "improvements"
#----------------------------------------------------------------------------
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for V2.5
-#
-# 11/24/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
-# o Added Bind() handlers to what events can handle it. However, the
-# colourselect library must be converted before its events can be
-# bound using the Bind() method.
-#
-# 12/01/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o colourselect lib converted; demo converted to match.
-#
import wx
import wx.lib.colourselect as csel
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
#'this is a long item that needs a scrollbar...',
'six', 'seven', 'eight']
- wx.StaticText(self, -1, "This example uses the wxComboBox control.", (8, 10))
+ wx.StaticText(self, -1, "This example uses the wx.ComboBox control.", (8, 10))
wx.StaticText(self, -1, "Select one:", (15, 50), (75, 18))
# This combobox is created with a preset list of values.
(95, -1), sampleList, wx.CB_DROPDOWN #|wxTE_PROCESS_ENTER
)
- ##import win32api, win32con
- ##win32api.SendMessage(cb.GetHandle(),
- ## win32con.CB_SETHORIZONTALEXTENT,
- ## 200, 0)
-
self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, cb)
self.Bind(wx.EVT_TEXT, self.EvtText, cb)
self.Bind(wx.EVT_TEXT_ENTER, self.EvtTextEnter, cb)
#---------------------------------------------------------------------------
-
overview = """\
A ComboBox is like a combination of an edit control and a listbox. It can be
displayed as static list with editable or read-only text field; or a drop-down
"""
+#---------------------------------------------------------------------------
+
if __name__ == '__main__':
import sys,os
import run
-# 11/4/2003 - grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Modified for V2.5
-#
-# 11/24/2003 - grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Removed import of wx.help - now part of wx.core.
-#
import wx
-# 11/5/2003 - Modified by grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Updated for wx namespace
-#
-# 11/24/2003 - Modified by grimmtooth@softhome.net (Jeff Grimmett)
-#
-# o Issues around line 167. I'm stuck.
-#
import cPickle
import wx
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
style=wx.DEFAULT_DIALOG_STYLE
):
- # Instead of calling wxDialog.__init__ we precreate the dialog
+ # Instead of calling wx.Dialog.__init__ we precreate the dialog
# so we can set an extra style that must be set before
# creation, and then we create the GUI dialog using the Create
# method.
# contents
sizer = wx.BoxSizer(wx.VERTICAL)
- label = wx.StaticText(self, -1, "This is a wxDialog")
+ label = wx.StaticText(self, -1, "This is a wx.Dialog")
label.SetHelpText("This is the help text for the label")
sizer.Add(label, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
# Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------------
-# Updated 11/9/2003 by Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Converted for V2.5 compatability
#
import wx
-# 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-# 11/5/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Got rid of all the hardcoded window IDs.
-# o Fixed a bug in class TestPanel() (empty sizer Add())
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Fixed a bug in the BMP file dialog; was using GetFilename()
-# instead of GetPath() to get the file to load.
-#
import wx
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import images
-# 11/5/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Replaced all calls to deprecated whrandom module with up to date random calls.
-# See Python docs regarding whrandom for details.
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o New binding
-#
import random
import time
-# 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import wx.gizmos as gizmos
-# 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Added overview text based on source code delving.
-#
import wx
import wx.gizmos as gizmos
-# 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/28/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o editor lib hasn't been hit by the renamer yet.
-#
-# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxEditor -> Editor
-#
import wx
import wx.lib.editor as editor
# Copyright: (c) 2002 by Robb Shecter (robb@acm.org)
# Licence: wxWindows license
#---------------------------------------------------------------------------
-#
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o What happened to wx.Color()?
-#
-
import wx
import wx.lib.evtmgr as em
-# 11/5/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated to wx namespace
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Issues previously noted have evaporated.
-# o Hoo boy, the doc string in the lib needs fixed :-)
-#
-# 12/02/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Making the library's doc string acceptable for the overview rendered
-# it unusable in the library's own test code, so I copied it over
-# and massaged the XML into useful HTML.
-#
import wx
import wx.lib.fancytext as fancytext
-# 11/7/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Uncommented fbbhCallback in TestPanel.fbbh init. Appears to work fine.
-# Wonder why it was commented.
-# o Unrelated: TestPanel.dbb appears to cause a program error in the demo. If
-# it is commented out, everything works fine. Investigating.
-# o Bernhard has responded to query, does not plan on updating demo.
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o All issues, including the program error, have gone away in V2.5.
-#
""" Demonstrate filebrowsebutton module of the wxPython.lib Library.
-# 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import os
import wx
#---------------------------------------------------------------------------
# This is how you pre-establish a file filter so that the dialog
-# only shows the extention(s) you want it to.
+# only shows the extension(s) you want it to.
wildcard = "Python source (*.py)|*.py|" \
"Compiled Python (*.pyc)|*.pyc|" \
"All files (*.*)|*.*"
-# 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import os
import wx
#---------------------------------------------------------------------------
# This is how you pre-establish a file filter so that the dialog
-# only shows the extention(s) you want it to.
+# only shows the extension(s) you want it to.
wildcard = "Python source (*.py)|*.py|" \
"Compiled Python (*.pyc)|*.pyc|" \
"SPAM files (*.spam)|*.spam|" \
the file names themselves, in a Python list. GetPaths() returns the full path and
filenames combined as a Python list.
-One important thing to note: if you use the file extention filters, then files saved
-with the filter set to something will automatically get that extention appended to them
+One important thing to note: if you use the file extension filters, then files saved
+with the filter set to something will automatically get that extension appended to them
if it is not already there. For example, suppose the dialog was displaying the 'egg'
-extention and you entered a file name of 'fried'. It would be saved as 'fried.egg.'
+extension and you entered a file name of 'fried'. It would be saved as 'fried.egg.'
Yum!
"""
-# 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import os
import wx
et = evt.GetEventType()
- #print evt.GetReplaceString()
-
if et in map:
evtType = map[et]
else:
else:
replaceTxt = ""
- self.log.write("%s -- Find text: %s %s Flags: %d \n" %
+ self.log.write("%s -- Find text: %s Replace text: %s Flags: %d \n" %
(evtType, evt.GetFindString(), replaceTxt, evt.GetFlags()))
-# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
-# o Updated for wx namespace
-# o OK, Main.py indicates this is deprecated. But I don't see a
-# replacement yet. So conversion is done anyway.
-#
-# 11/28/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Issues - library has to be converted to work properly
-# with new namespace.
-#
-# 12/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxFloatBar -> FloatBar
+# Please note that wx.lib.floatbar is not formally supported as
+# part of wxPython. If it works, fine. If not, unfortunate.
+# GTK users can use the wx.TB_DOCKABLE flag with a regular
+# wx.ToolBar, but everyone else has to take thier chances.
#
import wx
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for V2.5
-#
import wx
-# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
self.Bind(wx.EVT_BUTTON, self.OnSelectFont, btn)
self.sampleText = wx.TextCtrl(self, -1, "Sample Text")
- #from wxPython.lib.stattext import wxGenStaticText
- #self.sampleText = wxGenStaticText(self, -1, "Sample Text")
self.curFont = self.sampleText.GetFont()
self.curClr = wx.BLACK
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for V2.5
-#
import wx
-# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
#---------------------------------------------------------------------------
def runTest(frame, nb, log):
- win = MyFrame(frame, -1, "This is a wxFrame", size=(350, 200),
+ win = MyFrame(frame, -1, "This is a wx.Frame", size=(350, 200),
style = wx.DEFAULT_FRAME_STYLE)# | wx.FRAME_TOOL_WINDOW )
frame.otherWin = win
win.Show(True)
if not haveGLCanvas:
def runTest(frame, nb, log):
dlg = wx.MessageDialog(
- frame, 'The wxGLCanvas has not been included with this build of wxPython!',
+ frame, 'The wx.GLCanvas has not been included with this build of wxPython!',
'Sorry', wx.OK | wx.ICON_INFORMATION
)
box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 15)
self.Bind(wx.EVT_BUTTON, self.OnButton, id=k)
- #** Enable this to show putting a wxGLCanvas on the wxPanel
+ #** Enable this to show putting a wx.GLCanvas on the wxPanel
if 0:
c = CubeCanvas(self)
c.SetSize((200, 200))
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
self.log = log
self.count = 0
- wx.StaticText(self, -1, "This example shows the wxGauge control.", (45, 15))
+ wx.StaticText(self, -1, "This example shows the wx.Gauge control.", (45, 15))
self.g1 = wx.Gauge(self, -1, 50, (110, 50), (250, 25))
self.g1.SetBezelFace(3)
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import wx.lib.buttons as buttons
# A regular button, selected as the default button
b = wx.Button(self, -1, "A real button")
b.SetDefault()
- self.Bind(wx.EVT_BUTTON, self.OnButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnButton, b)
sizer.Add(b)
# Same thing, but NOT set as the default button
b = wx.Button(self, -1, "non-default")
- self.Bind(wx.EVT_BUTTON, self.OnButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnButton, b)
sizer.Add(b)
sizer.Add((10,10))
# Plain old text button based off GenButton()
b = buttons.GenButton(self, -1, 'Hello')
- self.Bind(wx.EVT_BUTTON, self.OnButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnButton, b)
sizer.Add(b)
# Plain old text button, disabled.
b = buttons.GenButton(self, -1, 'disabled')
- self.Bind(wx.EVT_BUTTON, self.OnButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnButton, b)
b.Enable(False)
sizer.Add(b)
# This time, we let the botton be as big as it can be.
# Also, this one is fancier, with custom colors and bezel size.
b = buttons.GenButton(self, -1, 'bigger')
- self.Bind(wx.EVT_BUTTON, self.OnBiggerButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnBiggerButton, b)
b.SetFont(wx.Font(20, wx.SWISS, wx.NORMAL, wx.BOLD, False))
b.SetBezelWidth(5)
###b.SetBestSize()
# An image button
bmp = images.getTest2Bitmap()
b = buttons.GenBitmapButton(self, -1, bmp)
- self.Bind(wx.EVT_BUTTON, self.OnButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnButton, b)
sizer.Add(b)
# An image button, disabled.
bmp = images.getTest2Bitmap()
b = buttons.GenBitmapButton(self, -1, bmp)
- self.Bind(wx.EVT_BUTTON, self.OnButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnButton, b)
sizer.Add(b)
b.Enable(False)
# An image button, using a mask to get rid of the
# undesireable part of the image
b = buttons.GenBitmapButton(self, -1, None)
- self.Bind(wx.EVT_BUTTON, self.OnButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnButton, b)
bmp = images.getBulb1Bitmap()
mask = wx.MaskColour(bmp, wx.BLUE)
bmp.SetMask(mask)
# A toggle button
b = buttons.GenToggleButton(self, -1, "Toggle Button")
- self.Bind(wx.EVT_BUTTON, self.OnToggleButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnToggleButton, b)
sizer.Add(b)
# An image toggle button
b = buttons.GenBitmapToggleButton(self, -1, None)
- self.Bind(wx.EVT_BUTTON, self.OnToggleButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnToggleButton, b)
bmp = images.getBulb1Bitmap()
mask = wx.MaskColour(bmp, wx.BLUE)
bmp.SetMask(mask)
# A bitmap button with text.
b = buttons.GenBitmapTextButton(self, -1, None, "Bitmapped Text", size = (200, 45))
- self.Bind(wx.EVT_BUTTON, self.OnButton, id=b.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnButton, b)
bmp = images.getBulb1Bitmap()
mask = wx.MaskColour(bmp, wx.BLUE)
bmp.SetMask(mask)
-# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
#---------------------------------------------------------------------------
buttonDefs = {
- 814 : ('GridSimple', ' Simple wxGrid, catching all events '),
- 815 : ('GridStdEdRend', ' wxGrid showing Editors and Renderers '),
- 818 : ('GridHugeTable', ' A wxGrid with a HUGE table (100 MILLION cells!) '),
- 817 : ('GridCustTable', ' wxGrid using a custom Table, with non-string data '),
+ 814 : ('GridSimple', ' Simple wx.Grid, catching all events '),
+ 815 : ('GridStdEdRend', ' wx.Grid showing Editors and Renderers '),
+ 818 : ('GridHugeTable', ' A wx.Grid with a HUGE table (100 MILLION cells!) '),
+ 817 : ('GridCustTable', ' wx.Grid using a custom Table, with non-string data '),
819 : ('GridEnterHandler',' Remapping keys to behave differently '),
820 : ('GridCustEditor', ' Shows how to create a custom Cell Editor '),
- 821 : ('GridDragable', ' A wxGrid with dragable rows and columns '),
+ 821 : ('GridDragable', ' A wx.Grid with dragable rows and columns '),
822 : ('GridDragAndDrop', ' Shows how to make a grid a drop target for files'),
}
overview = """\
<html><body>
-<h2>wxGrid</h2>
+<h2>wx.Grid</h2>
This demo shows various ways of using the <b><i>new and
-improved</i></b> wxGrid class. Unfortunatly it has not been
+improved</i></b> wx.Grid class. Unfortunatly it has not been
documented yet, and while it is somewhat backwards compatible, if you
-try to go by the current wxGrid documentation you will probably just
+try to go by the current wx.Grid documentation you will probably just
confuse yourself.
<p>
You can look at the sources for these samples to learn a lot about how
#----------------------------------------------------------------------
gbsDescription = """\
-The wxGridBagSizer is similar to the wxFlexGridSizer except the items are explicitly positioned
+The wx.GridBagSizer is similar to the wx.FlexGridSizer except the items are explicitly positioned
in a virtual cell of the layout grid, and column or row spanning is allowed. For example, this
static text is positioned at (0,0) and it spans 7 columns.
"""
class TestFrame(wx.Frame):
def __init__(self):
- wx.Frame.__init__(self, None, -1, "wxGridBagSizer")
+ wx.Frame.__init__(self, None, -1, "wx.GridBagSizer")
p = wx.Panel(self, -1)
p.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
else:
if self.gbs.CheckForIntersection( (3,6), (1,1) ):
wx.MessageBox("""\
-wxGridBagSizer will not allow items to be in the same cell as
+wx.GridBagSizer will not allow items to be in the same cell as
another item, so this operation will fail. You will also get an assert
when compiled in debug mode.""",
"Warning", wx.OK | wx.ICON_INFORMATION)
overview = """<html><body>
-<h2><center>wxGridBagSizer</center></h2>
+<h2><center>wx.GridBagSizer</center></h2>
-The wxGridBagSizer is more or less a port of the the RowColSizer (that
+The wx.GridBagSizer is more or less a port of the the RowColSizer (that
has been in the wxPython.lib package for quite some time) to C++. It
allows items to be placed at specific layout grid cells, and items can
span across more than one row or column.
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# Modified for wx namespace
-#
import string
Notice that in order to call the base class version of these special
methods we use the method name preceded by "base_". This is because these
- methods are "virtual" in C++ so if we try to call wxGridCellEditor.Create
+ methods are "virtual" in C++ so if we try to call wx.GridCellEditor.Create
for example, then when the wxPython extension module tries to call
ptr->Create(...) then it actually calls the derived class version which
looks up the method in this class and calls it, causing a recursion loop.
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Also corrected minor bug where 'true' was being used instead of 'True'.
-# Doesn't fail for * import (I guess that is still defined in wx), but does
-# in the manner we're importing wx now.
import wx
import wx.grid as gridlib
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
"""
Example showing how to make a grid a drop target for files.
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Modified for V2.5
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wx renamer didn't appear to 'catch' all the classes in
-# wx.lib.gridmovers
-# o Event binder not working properly with wx.lib.gridmovers
-#
import wx
import wx.grid as gridlib
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import wx.grid as gridlib
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import wx.grid as gridlib
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for V2.5
-# o The mixin features were all commented out. Is it broke? Should it even
-# be in the source? Or is it left as an exercise to the reader?
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Robin confirms, this is tutorial code. But be warned! It has not been
-# converted OR tested!
-#
import wx
import wx.grid as gridlib
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for V2.5
-# o There is one wx.Size() I haven't figured out how to get rid of yet.
-#
import random
-# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import wx.grid as Grid
class MegaTable(Grid.PyGridTableBase):
"""
- A custom wxGrid Table using user supplied data
+ A custom wx.Grid Table using user supplied data
"""
def __init__(self, data, colnames, plugins):
"""data is a list of the form
def _updateColAttrs(self, grid):
"""
- wxGrid -> update the column attributes to add the
+ wx.Grid -> update the column attributes to add the
appropriate renderer given the column name. (renderers
are stored in the self.plugins dictionary)
# --------------------------------------------------------------------
-# Sample wxGrid renderers
+# Sample wx.Grid renderers
class MegaImageRenderer(Grid.PyGridCellRenderer):
def __init__(self, table):
-# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 12/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o got the wxpTag stuff working right.
-#
-# 12/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxScrolledMessageDialog -> ScrolledMessageDialog
-#
import os
import sys
overview = """<html><body>
-<h2>wxHtmlWindow</h2>
+<h2>wx.HtmlWindow</h2>
-<p>wxHtmlWindow is capable of parsing and rendering most
+<p>wx.HtmlWindow is capable of parsing and rendering most
simple HTML tags.
<p>It is not intended to be a high-end HTML browser. If you're
overview = """\
<html><body>
-<h2>wxIEHtmlWin</h2>
+<h2>wx.IEHtmlWin</h2>
-The wxIEHtmlWin class is the first example of using a contributed
+The wx.IEHtmlWin class is the first example of using a contributed
wxActiveX class in wxWindows C++. It is still experimental, but
I think it is useful.
-# 11/19/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
# Date: Feb 26, 2001
# Licence: wxWindows license
#----------------------------------------------------------------------------
-#
-# 11/23/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Library has to be updated, it is using obsolete names
-# (wxPyDefaultSize, etc)
-#
import os
-# 11/19/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import cStringIO
-# 11/19/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/29/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o intctrl needs the renamer applied.
-# o intctrl needs new event binders.
-#
-# 12/08/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o All issues corrected
-#
-# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxIntCtrl -> IntCtrl
-#
import wx
import wx.lib.intctrl
-# 11/19/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/29/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o lib.mixins.listctrl needs wx renamer applied.
-#
-# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxListCtrlAutoWidthMixin -> ListCtrlAutoWidthMixin
-#
import wx
import wx.lib.mixins.listctrl as listmix
-# 11/19/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import time
source, which was a bit reluctant to reveal its secrets. My appologies if
I missed anything - jmg</font>
<p>
-<code><b>wxLEDNumberCtrl</b>( parent, id=-1, pos=wx.DefaultPosition,
+<code><b>LEDNumberCtrl</b>( parent, id=-1, pos=wx.DefaultPosition,
size=wx.DefaultSize, style=LED_ALIGN_LEFT | LED_DRAW_FADED)</code>
<p>This is a control that simulates an LED clock display. It only accepts
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o In the lambda function at the top, removed the leading 'wx' from the
-# ID names to remove confusion with 'official' wx members.
-#
import wx
import wx.lib.anchors as anchors
-# 11/19/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-# 11/12/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Controls now use dynamic IDs instead of hardcoded IDs.
-#
import wx
import wx.lib.layoutf as layoutf
#---------------------------------------------------------------------------
-ID_Button = wx.NewId()
-
-#---------------------------------------------------------------------------
-
class TestLayoutf(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
self.SetAutoLayout(True)
- self.Bind(wx.EVT_BUTTON, self.OnButton, id=ID_Button)
+ self.Bind(wx.EVT_BUTTON, self.OnButton)
self.panelA = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
self.panelA.SetBackgroundColour(wx.BLUE)
layoutf.Layoutf('t_10#3;r=r10#1;b=b10#1;l>10#2', (self,self.panelA,self.panelB))
)
- b = wx.Button(self.panelA, ID_Button, ' Panel A ')
+ b = wx.Button(self.panelA, -1, ' Panel A ')
b.SetConstraints(layoutf.Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self.panelA,)))
- b = wx.Button(self.panelB, ID_Button, ' Panel B ')
+ b = wx.Button(self.panelB, -1, ' Panel B ')
b.SetConstraints(layoutf.Layoutf('t=t2#1;r=r4#1;h*;w*', (self.panelB,)))
self.panelD = wx.Window(self.panelC, -1, style=wx.SIMPLE_BORDER)
layoutf.Layoutf('b%h50#1;r%w50#1;h=h#2;w=w#2', (self.panelC, b))
)
- b = wx.Button(self.panelC, ID_Button, ' Panel C ')
+ b = wx.Button(self.panelC, -1, ' Panel C ')
b.SetConstraints(layoutf.Layoutf('t_#1;l>#1;h*;w*', (self.panelD,)))
wx.StaticText(self.panelD, -1, "Panel D", (4, 4)).SetBackgroundColour(wx.GREEN)
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
'six', 'seven', 'eight', 'nine', 'ten', 'eleven',
'twelve', 'thirteen', 'fourteen']
- wx.StaticText(self, -1, "This example uses the wxListBox control.", (45, 10))
+ wx.StaticText(self, -1, "This example uses the wx.ListBox control.", (45, 10))
wx.StaticText(self, -1, "Select one:", (15, 50), (65, 18))
self.lb1 = wx.ListBox(self, 60, (80, 50), (80, 120), sampleList, wx.LB_SINGLE)
self.Bind(wx.EVT_LISTBOX, self.EvtListBox, self.lb1)
# Copyright: (c) 1998 by Total Control Software
# Licence: wxWindows license
#----------------------------------------------------------------------------
-#
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/29/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o listctrl mixin needs wx renamer.
-# o wx.ListItem.GetText() returns a wxString pointer, not the text.
-#
-# 12/14/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o ColumnSorterMixin implementation was broke - added event.Skip()
-# to column click event to allow event to fall through to mixin.
-#
-# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxColumnSorterMixin -> ColumnSorterMixin
-# o wxListCtrlAutoWidthMixin -> ListCtrlAutoWidthMixin
-#
import wx
import wx.lib.mixins.listctrl as listmix
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/29/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wx.ListItem.GetText() returns a wxString pointer, not the text.
-#
import wx
import images
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/29/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Bunches of imports that might need to go away for the final roll-out.
-#
import sys
import wx
-import images
-
import ColorPanel
+import images
colourList = [ "Aquamarine", "Black", "Blue", "Blue Violet", "Brown", "Cadet Blue",
"Coral", "Cornflower Blue", "Cyan", "Dark Grey", "Dark Green",
overview = """\
<html><body>
-<h2>wxListbook</h2>
+<h2>wx.Listbook</h2>
<p>
This class is a control similar to a notebook control, but with a
-wxListCtrl instead of a set of tabs.
+wx.ListCtrl instead of a set of tabs.
"""
-#!/usr/bin/env python
-
-# 11/12/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Replaced hardcoded menu IDs with dynamic IDs
-#
import wx
#!/usr/bin/env python
-# 11/6/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-
import wx
import ScrolledWindow
-# 11/12/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Library must be updated for this to run.
-#
-# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxMVCTree -> MVCTree
-#
import os
import sys
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-# 11/23/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o the three libraries below all have not been hit by the
-# wx renamer.
-#
-# 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o A few changes to correct my own mistakes earlier :-).
-#
-# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxMaskedTextCtrl -> MaskedTextCtrl
-# o wxMaskedComboBox -> MaskedComboBox
-# o wxIpAddrCtrl -> IpAddrCtrl
-# o wxMaskedNumCtrl -> MaskedNumCtrl
-# o wxTimeCtrl -> TimeCtrl
-# o wxScrolledPanel -> ScrolledPanel
-#
import string
import sys
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/29/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wx.lib.maskednumctrl needs hit up with the renamer and new binders
-#
-# 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Issues with lib corrected.
-#
-# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxMaskedNumCtrl -> MaskedNumCtrl
-#
import string
import sys
# menus in wxPython 2.3.3
#
#-------------------------------------------------------------------
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
-# o Updated for wx namespace
-#
+# o Debug message when adding a menu item (see last menu):
+#
+# Debug: ..\..\src\msw\menuitem.cpp(370): 'GetMenuState' failed with
+# error 0x00000002 (the system cannot find the file specified.).
+#
import time
import wx
text = item.GetText()
help = item.GetHelp()
- #print text, help
# but in this case just call Skip so the default is done
event.Skip()
overview = """\
-A demo of using wxMenuBar and wxMenu in various ways.
+A demo of using wx.MenuBar and wx.Menu in various ways.
A menu is a popup (or pull down) list of items, one of which may be selected
before the menu goes away (clicking elsewhere dismisses the menu). Menus may be
don't have any special properties while the check items have a boolean flag associated
to them and they show a checkmark in the menu when the flag is set. wxWindows
automatically toggles the flag value when the item is clicked and its value may
-be retrieved using either IsChecked method of wxMenu or wxMenuBar itself or by
+be retrieved using either IsChecked method of wx.Menu or wx.MenuBar itself or by
using wxEvent.IsChecked when you get the menu notification for the item in question.
The radio items are similar to the check items except that all the other items
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
The dialog can be modal or not; of modal, the user's response is in the return
code of ShowModal(). If not, the response can be taken from GetReturnCode() (inherited
-from the wxDialog super class). If not modal and the return code is required, it
+from the wx.Dialog). If not modal and the return code is required, it
must be retrieved before the dialog is destroyed.
"""
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
#---------------------------------------------------------------------------
def runTest(frame, nb, log):
- win = MyMiniFrame(frame, "This is a wxMiniFrame",
+ win = MyMiniFrame(frame, "This is a wx.MiniFrame",
#pos=(250,250), size=(200,200),
style=wx.DEFAULT_FRAME_STYLE | wx.TINY_CAPTION_HORIZ)
win.SetSize((200, 200))
overview = """\
-A miniframe is a frame with a small title bar. It is suitable for floating
+A MiniFrame is a Frame with a small title bar. It is suitable for floating
toolbars that must not take up too much screen area. In other respects, it's the
-same as a wxFrame.
+same as a wx.Frame.
"""
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wx renamer needs to be applied to multisash lib.
-# o There appears to be a problem with the image that
-# the library is trying to use for the alternate cursor
-#
-# 12/09/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o renamer issue shelved.
-#
-# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxMultiSash -> MultiSash
-#
import wx
import wx.lib.multisash as sash
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wx renamer not applied to lib.
-#
-# 12/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxMultipleChoiceDialog -> MultipleChoiceDialog
-#
import wx
import wx.lib.dialogs
proper, so don't let the wxWindows documentation mislead you.
<p><code><b>MultipleChoiceDialog</b>(self, parent, msg, title, lst,
-pos = wx.wxDefaultPosition, size = (200,200), style = wx.wxDEFAULT_DIALOG_STYLE)
+pos = wx.wxDefaultPosition, size = (200,200), style = wx.DEFAULT_DIALOG_STYLE)
</code>
<dl>
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import sys
overview = """\
<html><body>
-<h2>wxNotebook</h2>
+<h2>wx.Notebook</h2>
<p>
This class represents a notebook control, which manages multiple
windows with associated tabs.
<p>
-To use the class, create a wxNotebook object and call AddPage or
+To use the class, create a wx.Notebook object and call AddPage or
InsertPage, passing a window to be used as the page. Do not explicitly
-delete the window for a page that is currently managed by wxNotebook.
+delete the window for a page that is currently managed by wx.Notebook.
"""
def __del__(self):
self.cleanup()
-# when this module gets cleaned up then wxOGLCleanUp() will get called
+# when this module gets cleaned up then wx.OGLCleanUp() will get called
__cu = __Cleanup()
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import wx.html as wxhtml
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
(landscape or portrait), and controls for setting left, top, right and bottom margin
sizes in millimetres.
-When the dialog has been closed, you need to query the <code>wxPageSetupDialogData</code> object
+When the dialog has been closed, you need to query the <code>wx.PageSetupDialogData</code> object
associated with the dialog.
Note that the OK and Cancel buttons do not destroy the dialog; this must be done by
the application. As with other dialogs, do not destroy the dialog until you are done
-with the data, and, conversely, do not use the wxPageSetupDialogData after the
+with the data, and, conversely, do not use the wx.PageSetupDialogData after the
dialog is destroyed.
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+
#
-# o Updated for wx namespace
-#
-# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
+# wx.lib.wxPlotCanvas is deprecated. Use wx.lib.plot instead.
#
-# o wxPlotCanvas must be updated with new draw mechanics (tuples) before
-# it can be used with 2.5.
-#
import wx
import wx.lib.wxPlotCanvas as plot
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Is it just me or are the graphics for the control not lining up right?
-#
-# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxPopupControl -> PopupControl
-#
import wx
import wx.lib.popupctl as pop
<h2><center>PopupControl</center></h2>
PopupControl is a class that can display a value and has a button
-that will popup another window similar to how a wxComboBox works. The
+that will popup another window similar to how a wx.ComboBox works. The
popup window can contain whatever is needed to edit the value. This
-example uses a wxCalendarCtrl.
+example uses a wx.CalendarCtrl.
-<p>Currently a wxDialog is used for the popup. Eventually a
-wxPopupWindow should be used...
+<p>Currently a wx.Dialog is used for the popup. Eventually a
+wx.PopupWindow should be used...
</body></html>
"""
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
import wx
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
#
# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o Some issues with the listbox example; I tried correcting
# it but it's still not working the way it should. Commented
-# out for now but will be revisited.
-# o The math in determining the popup window's position is
-# a bit off.
+# out for now, as I found it.
#
import wx
#---------------------------------------------------------------------------
class TestPopup(wx.PopupWindow):
- """Adds a bit of text and mouse movement to the wxPopupWindow"""
+ """Adds a bit of text and mouse movement to the wx.PopupWindow"""
def __init__(self, parent, style):
wx.PopupWindow.__init__(self, parent, style)
self.SetBackgroundColour("CADET BLUE")
class TestTransientPopup(wx.PopupTransientWindow):
- """Adds a bit of text and mouse movement to the wxPopupWindow"""
+ """Adds a bit of text and mouse movement to the wx.PopupWindow"""
def __init__(self, parent, style, log):
wx.PopupTransientWindow.__init__(self, parent, style)
self.log = log
panel = wx.Panel(self, -1)
panel.SetBackgroundColour("#FFB6C1")
st = wx.StaticText(panel, -1,
- "wxPopupTransientWindow is a\n"
- "wxPopupWindow which disappears\n"
+ "wx.PopupTransientWindow is a\n"
+ "wx.PopupWindow which disappears\n"
"automatically when the user\n"
"clicks the mouse outside it or if it\n"
"(or its first child) loses focus in \n"
wx.Panel.__init__(self, parent, -1)
self.log = log
- b = wx.Button(self, -1, "Show wxPopupWindow", (25, 50))
+ b = wx.Button(self, -1, "Show wx.PopupWindow", (25, 50))
self.Bind(wx.EVT_BUTTON, self.OnShowPopup, b)
- b = wx.Button(self, -1, "Show wxPopupTransientWindow", (25, 95))
+ b = wx.Button(self, -1, "Show wx.PopupTransientWindow", (25, 95))
self.Bind(wx.EVT_BUTTON, self.OnShowPopupTransient, b)
# This isn't working so well, not sure why. Commented out for
# now.
-# b = wx.Button(self, -1, "Show wxPopupWindow with listbox", (25, 140))
+# b = wx.Button(self, -1, "Show wx.PopupWindow with listbox", (25, 140))
# self.Bind(wx.EVT_BUTTON, self.OnShowPopupListbox, b)
win.Show(True)
+# This class is currently not implemented in the demo. It does not
+# behave the way it should, so for the time being it's only here
+# for show. If you figure out how to make it work, please send
+# a corrected file to Robin!
class TestPopupWithListbox(wx.PopupWindow):
def __init__(self, parent, style, log):
wx.PopupWindow.__init__(self, parent, style)
return win
else:
dlg = wx.MessageDialog(
- frame, 'wxPopupWindow is not available on this platform.',
+ frame, 'wx.PopupWindow is not available on this platform.',
'Sorry', wx.OK | wx.ICON_INFORMATION
)
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
#---------------------------------------------------------------------------
overview = """\
This class represents the print and print setup common dialogs. You may obtain
-a wxPrinterDC device context from a successfully dismissed print dialog.
+a wx.PrinterDC device context from a successfully dismissed print dialog.
-User information is stored in a wxPrintDialogData object that is passed to the
+User information is stored in a wx.PrintDialogData object that is passed to the
dialog at creation time, and it is filled in by the user. As with other dialogs,
do not use this data once the dialog is dismissed, and do not destroy the dialog
until you have everything you need from it.
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Got rid of static buton IDs
-# o Took at a stab at a lucid overview string.
-#
import wx
import ScrolledWindow
-# 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
self.process = None
self.Bind(wx.EVT_IDLE, self.OnIdle)
- # We can either derive from wxProcess and override OnTerminate
- # or we can let wxProcess send this window an event that is
+ # We can either derive from wx.Process and override OnTerminate
+ # or we can let wx.Process send this window an event that is
# caught in the normal way...
self.Bind(wx.EVT_END_PROCESS, self.OnProcessEnded)
overview = """\
<html><body>
-<h2>wxProcess</h2>
+<h2>wx.Process</h2>
-wxProcess lets you get notified when an asyncronous child process
+wx.Process lets you get notified when an asyncronous child process
started by wxExecute terminates, and also to get input/output streams
for the child process's stdout, stderr and stdin.
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 12/14/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated URL for SF link in overview.
-#
-# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxPyColorChooser -> PyColorChooser
-# o wxPyColourChooser -> PyColourChooser
-#
import wx
import wx.lib.colourchooser as cc
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx.py as py
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o New demo
-#
import wx
import wx.lib.plot
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx.py as py
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import sys
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
self.Bind(wx.EVT_RADIOBOX, self.EvtRadioBox, rb)
#rb.SetBackgroundColour(wx.BLUE)
rb.SetToolTip(wx.ToolTip("This is a ToolTip!"))
- #rb.SetLabel("wxRadioBox")
+ #rb.SetLabel("wx.RadioBox")
sizer.Add(rb, 0, wx.ALL, 20)
def EvtRadioBox(self, event):
self.log.WriteText('EvtRadioBox: %d\n' % event.GetInt())
-# Doesn't appear to be used for anything.
-# def EvtRadioButton(self, event):
-# self.log.write('EvtRadioButton:%d\n' % event.GetId())
-
#---------------------------------------------------------------------------
def runTest(frame, nb, log):
overview = """\
-A radio box item is used to select one of number of mutually exclusive
+A RadioBox is used to select one of a number of mutually exclusive
choices. It is displayed as a vertical column or horizontal row of
-labelled buttons.
+labelled buttons, surrounded by a box that can optionally have a
+label.
"""
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
This demo shows how individual radio buttons can be used to build
more complicated selection mechanisms...
<P>
-It uses 2 groups of wxRadioButtons, where the groups are defined by
-instantiation. When a wxRadioButton is created with the <I>wxRB_GROUP</I>
-style, all subsequent wxRadioButtons created without it are implicitly
+It uses 2 groups of wx.RadioButtons, where the groups are defined by
+instantiation. When a wx.RadioButton is created with the <I>wx.RB_GROUP</I>
+style, all subsequent wx.RadioButtons created without it are implicitly
added to that group by the framework.
</body></html>
"""
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o The rightalign library needs converted for this to work correctly.
-#
-# 12/11/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o All issues resolved.
-#
-# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxRightTextCtrl -> RightTextCtrl
-#
-
-############################################################################\
-# Note: this demo has been converted, but the control is deprecated because |
-# wx.TextCtrl now supports the wx.TE_RIGHT style flag, which makes this |
-# control completely superfluous. |
-############################################################################/
+#####################################################################\
+# Note: This control is deprecated because wx.TextCtrl now supports |
+# the wx.TE_RIGHT style flag, which makes this control completely |
+# superfluous. |
+#####################################################################/
import wx
-import wx.lib.rightalign as right
+import wx.lib.rightalign as right
#----------------------------------------------------------------------
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Gotta fix the overview.
-#
-# 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Overview fixed.
-#
import wx
import wx.lib.rcsizer as rcs
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Should be renamed to wxSashLayoutWindow.py
-#
import wx
overview = """\
-wxSashLayoutWindow responds to OnCalculateLayout events generated by
+wx.SashLayoutWindow responds to OnCalculateLayout events generated by
wxLayoutAlgorithm. It allows the application to use simple accessors to
specify how the window should be laid out, rather than having to respond
-to events. The fact that the class derives from wxSashWindow allows sashes
+to events. The fact that the class derives from wx.SashWindow allows sashes
to be used if required, to allow the windows to be user-resizable.
-The documentation for wxLayoutAlgorithm explains the purpose of this class
+The documentation for wx.LayoutAlgorithm explains the purpose of this class
in more detail.
"""
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o dialogs library needs updated to wx
-#
-# 12/01/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o dialogs library converted. All is well.
-#
-# 12/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxScrolledMessageDialog -> ScrolledMessageDialog
-#
import wx
import wx.lib.dialogs
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o scrolledpanel lib needs wx update
-#
-# 12/11/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o lib updated, all is well.
-#
-# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxScrolledPanel -> ScrolledPanel
-#
import wx
-import wx.lib.scrolledpanel as scrolled
+import wx.lib.scrolledpanel as scrolled
#----------------------------------------------------------------------
"ScrolledPanel extends wx.ScrolledWindow, adding all "
"the necessary bits to set up scroll handling for you.\n\n"
"Here are three fixed size examples of its use. The "
- "demo panel for this sample is also using it -- the \nwxStaticLine"
+ "demo panel for this sample is also using it -- the \nwxStaticLine "
"below is intentionally made too long so a scrollbar will be "
"activated."
)
-# 11/12/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Rudimentary overview doc added.
-#
import wx
-
import images
BUFFERED = 1
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import images
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Issues exist that will probably need to be addressed in the 2.5 build.
-#
# 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o Had to do a bit of rework for the demo; there was no panel attached
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
self.log = log
self.count = 0
- wx.StaticText(self, -1, "This is a wxSlider.", (45, 15))
+ wx.StaticText(self, -1, "This is a wx.Slider.", (45, 15))
slider = wx.Slider(
self, 100, 25, 1, 100, (30, 60), (250, -1),
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o EVT_SPIN events (or something about them) freezes up the app.
self.log = log
self.count = 0
- wx.StaticText(self, -1, "This example uses the wxSpinButton control.", (45, 15))
+ wx.StaticText(self, -1, "This example uses the wx.SpinButton control.", (45, 15))
self.text = wx.TextCtrl(self, -1, "1", (30, 50), (60, -1))
h = self.text.GetSize().height
overview = """\
-A wxSpinButton has two small up and down (or left and right) arrow buttons.
+A wx.SpinButton has two small up and down (or left and right) arrow buttons.
It is often used next to a text control for increment and decrementing a value.
-Portable programs should try to use wxSpinCtrl instead as wxSpinButton is not
+Portable programs should try to use wx.SpinCtrl instead as wx.SpinButton is not
implemented for all platforms (Win32 and GTK only currently).
-NB: the range supported by this control (and wxSpinCtrl) depends on the platform
+NB: the range supported by this control (and wx.SpinCtrl) depends on the platform
but is at least -0x8000 to 0x7fff. Under GTK and Win32 with sufficiently new version
of comctrl32.dll (at least 4.71 is required, 5.80 is recommended) the full 32 bit
range is supported.
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
self.log = log
self.count = 0
- wx.StaticText(self, -1, "This example uses the wxSpinCtrl control.", (45, 15))
+ wx.StaticText(self, -1, "This example uses the wx.SpinCtrl control.", (45, 15))
sc = wx.SpinCtrl(self, -1, "", (30, 50), (80, -1))
sc.SetRange(1,100)
sc.SetValue(5)
- #sc.Enable(False)
#----------------------------------------------------------------------
overview = """\
-wxSpinCtrl combines wxTextCtrl and wxSpinButton in one control.
+wx.SpinCtrl combines wx.TextCtrl and wx.SpinButton in one control.
-Portable programs should try to use wxSpinCtrl instead as wxSpinButton is not
+Portable programs should try to use this control as wx.SpinButton is not
implemented for all platforms (Win32 and GTK only currently).
NB: the range supported by this control depends on the platform
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
overview = """\
This class manages up to two subwindows. The current view can be split
into two programmatically (perhaps from a menu command), and unsplit
-either programmatically or via the wxSplitterWindow user interface.
+either programmatically or via the wx.SplitterWindow user interface.
"""
if __name__ == '__main__':
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import images
self.log = log
self.count = 0
- wx.StaticText(self, -1, "This is a wxStaticBitmap.", (45, 15))
+ wx.StaticText(self, -1, "This is a wx.StaticBitmap.", (45, 15))
bmp = images.getTest2Bitmap()
mask = wx.MaskColour(bmp, wx.BLUE)
#----------------------------------------------------------------------
overview = """\
-A static bitmap control displays a bitmap.
+A StaticBitmap control displays a bitmap.
The bitmap to be displayed should have a small number of colours, such as 16,
to avoid palette problems.
-A bitmap can be derived from most image formats using the wxImage class.
+A bitmap can be derived from most image formats using the wx.Image class.
"""
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Removed the USE_GENERIC code because it doesn't work unless you use
-# the 'from wx import *' methodology.
-#
import wx
wx.Panel.__init__(self, parent, -1)
wx.StaticText(self, -1, "This is an example of static text", (20, 10))
- wx.StaticText(self, -1, "using the wxStaticText Control.", (20, 30))
+ wx.StaticText(self, -1, "using the wx.StaticText Control.", (20, 30))
wx.StaticText(
self, -1, "Is this yellow?", (20, 70), (90, -1)
text.SetFont(font)
#text.SetSize(text.GetBestSize())
- wx.StaticText(self, -1, "Multi-line wxStaticText\nline 2\nline 3\n\nafter empty line", (20,150))
+ wx.StaticText(self, -1, "Multi-line wx.StaticText\nline 2\nline 3\n\nafter empty line", (20,150))
wx.StaticText(self, -1, "Align right multi-line\nline 2\nline 3\n\nafter empty line", (220,150), style=wx.ALIGN_RIGHT)
overview = '''\
-A static text control displays one or more lines of read-only text.
+A StaticText control displays one or more lines of read-only text.
'''
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import time
import wx
# This status bar has three fields
self.SetFieldsCount(3)
+ # Sets the three fields to be relative widths to each other.
+ self.SetStatusWidths([-2, -1, -2])
self.log = log
self.sizeChanged = False
self.Bind(wx.EVT_SIZE, self.OnSize)
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
#
# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
# o EVT_STC_DRAG_OVER event GetdragResult() is not an int
-# o wx.TheClipboard.Flush() generates an error on program exit.
+# o wx.TheClipboard.Flush() generates a warning on program exit.
#
import wx
demoText = """\
-This editor is provided by a class named wxStyledTextCtrl. As
+This editor is provided by a class named wx.StyledTextCtrl. As
the name suggests, you can define styles that can be applied to
sections of text. This will typically be used for things like
syntax highlighting code editors, but I'm sure that there are other
will let you know when the visible portion of the text needs
styling.
-wxStyledTextEditor also supports setting markers in the margin...
+wx.StyledTextEditor also supports setting markers in the margin...
#----------------------------------------------------------------------
-# This shows how to catch the Modified event from the wxStyledTextCtrl
+# This shows how to catch the Modified event from the wx.StyledTextCtrl
class MySTC(stc.StyledTextCtrl):
def __init__(self, parent, ID, log):
decode = codecs.lookup("utf-8")[1]
ed.GotoPos(ed.GetLength())
- ed.AddText("\n\nwxStyledTextCtrl can also do Unicode:\n")
+ ed.AddText("\n\nwx.StyledTextCtrl can also do Unicode:\n")
unitext, l = decode('\xd0\x9f\xd0\xb8\xd1\x82\xd0\xbe\xd0\xbd - '
'\xd0\xbb\xd1\x83\xd1\x87\xd1\x88\xd0\xb8\xd0\xb9 '
'\xd1\x8f\xd0\xb7\xd1\x8b\xd0\xba \xd0\xbf\xd1\x80\xd0\xbe\xd0\xb3\xd1\x80\xd0\xb0\xd0\xbc\xd0\xbc\xd0\xb8\xd1\x80\xd0\xbe\xd0\xb2\xd0\xb0\xd0\xbd\xd0\xb8\xd1\x8f!\n\n')
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import keyword
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:
+ elif self.fold_symbols == 2:
# Like a flattened tree control using circular headers and curved joins
self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_CIRCLEMINUS, "white", "#404040");
self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_CIRCLEPLUS, "white", "#404040");
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Color preview example generates deprecation warnings.
-#
-# 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Note: wx.NamedColour must remain because printout.py requiress it.
-# o printout.py is generating a snootful of errors all related to the
-# requirement for tuples on the base DC calls now
-#
-# 12/10/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Issues corrected.
-#
import os
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import sys
import wx
overview = """\
-A text control allows text to be displayed and (possibly) edited. It may be single
+A TextCtrl allows text to be displayed and (possibly) edited. It may be single
line or multi-line, support styles or not, be read-only or not, and even supports
text masking for such things as passwords.
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
def runTest(frame, nb, log):
dlg = wx.TextEntryDialog(
frame, 'What is your favorite programming language?',
- 'Duh??', 'Python')
+ 'Eh??', 'Python')
dlg.SetValue("Python is the best!")
overview = """\
This class represents a dialog that requests a one-line text string from the user.
-It is implemented as a generic wxWindows dialog. Along with the usual wxDialog
-style flags, all of the wxTextCtrl TE_* style flags are accepted, so, for example,
+It is implemented as a generic wxWindows dialog. Along with the usual wx.Dialog
+style flags, all of the wx.TextCtrl TE_* style flags are accepted, so, for example,
wx.TE_PASSWORD could be used to create a password dialog.
As with other dialogs of this type, the user input must be retrieved prior to
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o Replaced deprecated whrandom with random module.
-#
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Currently uses lib.newevent; should probably be updated to use
-# new-style event binder. OTOH, this is the only place we get
-# to see that library used that I know of.
-#
import random
import time
-#
-# Throbber.py - Cliff Wells <clifford.wells@attbi.com>
-#
-# 11/23/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-import wx.lib.rcsizer as rcs
import wx.lib.throbber as throb
import throbImages # this was created using a modified version of img2py
self.otherThrobber.Bind(wx.EVT_LEFT_DOWN, self.OnClickThrobber)
box = wx.BoxSizer(wx.VERTICAL)
- sizer = rcs.RowColSizer()
+ sizer = wx.GridBagSizer()
box.Add(sizer, 1, wx.EXPAND|wx.ALL, 5)
sizer.AddGrowableCol(1)
- sizer.Add(
- self.otherThrobber, row = 0, col = 2, rowspan = 4,
- flag = wx.ALIGN_CENTER_VERTICAL
- )
+ sizer.Add(self.otherThrobber, (0, 2), (4, 1),flag = wx.ALIGN_CENTER_VERTICAL)
row = 2
# use a list so we can keep our order
for t in ['plain', 'reverse', 'autoreverse', 'label', 'overlay', 'overlay+text']:
sizer.Add(
- self.throbbers[t]['throbber'], row = row, col = 0,
+ self.throbbers[t]['throbber'], (row, 0), (1, 1),
flag = wx.ALIGN_CENTER|wx.ALL, border=2
)
sizer.Add(
wx.StaticText(self, -1, self.throbbers[t]['text']),
- row = row, col = 1, flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT
+ (row, 1), flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT
)
row += 1
# start and stop buttons
startButton = wx.Button(self, -1, "Start")
- self.Bind(wx.EVT_BUTTON, self.OnStartAnimation, id=startButton.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnStartAnimation, startButton)
stopButton = wx.Button(self, -1, "Stop")
- self.Bind(wx.EVT_BUTTON, self.OnStopAnimation, id=stopButton.GetId())
+ self.Bind(wx.EVT_BUTTON, self.OnStopAnimation, stopButton)
buttonBox = wx.BoxSizer(wx.HORIZONTAL)
buttonBox.AddMany([
(stopButton, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 5),
])
- sizer.Add(buttonBox,
- row = len(self.throbbers) + 3,
- col = 0,
- colspan = 3,
- flag = wx.ALIGN_CENTER
- )
+ sizer.Add(
+ buttonBox, (len(self.throbbers) + 3, 0), (1, 3), flag = wx.ALIGN_CENTER
+ )
self.SetSizer(box)
self.SetAutoLayout(True)
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
#
# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
#
-# o wx renamer needed for timectrl lib
# o presense of spin control causing probs (see spin ctrl demo for details)
#
-# 12/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o New binders applied. Issues still exist.
-#
-# 12/20/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o wxTimeCtrl -> TimeCtrl
-# o wxScrolledPanel -> ScrolledPanel
-#
import wx
import wx.lib.timectrl as timectl
elif self.radioWx.GetValue():
now = wx.DateTime_Now()
self.time12.SetValue( now )
- # (demonstrates that G/SetValue returns/takes a wxDateTime)
+ # (demonstrates that G/SetValue returns/takes a wx.DateTime)
self.time24.SetValue( self.time12.GetValue(as_wxDateTime=True) )
- # (demonstrates that G/SetValue returns/takes a wxTimeSpan)
+ # (demonstrates that G/SetValue returns/takes a wx.TimeSpan)
self.spinless_ctrl.SetValue( self.time12.GetValue(as_wxTimeSpan=True) )
elif self.radioMx.GetValue():
cur_min, cur_max = self.target_ctrl.GetBounds()
- # jmg - A little expirimental change to ensure that min
- # or max contain valid values before we use them
if min and (min != cur_min): self.target_ctrl.SetMin( min )
if max and (max != cur_max): self.target_ctrl.SetMax( max )
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
#
+# 1/11/2004 - Jeff Grimmett (grimmtooth@softhome.net)
+#
+# o It appears that wx.Timer has an issue where if you use
+#
+# self.timer = wx.Timer(self, -1)
+#
+# to create it, then
+#
+# self.timer.GetId()
+#
+# doesn't seem to return anything meaningful. In the demo, doing this
+# results in only one of the two handlers being called for both timers.
+# This means that
+#
+# self.Bind(wx.EVT_TIMER, self.onTimer, self.timer)
+#
+# doesn't work right. However, using
+#
+# self.timer = wx.Timer(self, wx.NewId())
+#
+# makes it work OK. I believe this is a bug, but wiser heads than mine
+# should determine this.
+#
import time
import wx
## For your convenience; an example of creating your own timer class.
##
-## class TestTimer(wxTimer):
+## class TestTimer(wx.Timer):
## def __init__(self, log = None):
-## wxTimer.__init__(self)
+## wx.Timer.__init__(self)
## self.log = log
## def Notify(self):
-## wxBell()
+## wx.Bell()
## if self.log:
## self.log.WriteText('beep!\n')
#---------------------------------------------------------------------------
-ID_Start = wx.NewId()
-ID_Stop = wx.NewId()
-ID_Timer = wx.NewId()
-ID_Timer2 = wx.NewId()
-
class TestTimerWin(wx.Panel):
def __init__(self, parent, log):
wx.Panel.__init__(self, parent, -1)
self.log = log
wx.StaticText(self, -1, "This is a timer example", (15, 30))
- wx.Button(self, ID_Start, ' Start ', (15, 75), wx.DefaultSize)
- wx.Button(self, ID_Stop, ' Stop ', (115, 75), wx.DefaultSize)
-
- self.timer = wx.Timer(self, # object to send the event to
- ID_Timer) # event id to use
+ startBtn = wx.Button(self, -1, ' Start ', (15, 75), wx.DefaultSize)
+ stopBtn = wx.Button(self, -1, ' Stop ', (115, 75), wx.DefaultSize)
- self.timer2 = wx.Timer(self, # object to send the event to
- ID_Timer2) # event id to use
+ self.timer = wx.Timer(self, wx.NewId())
+ self.timer2 = wx.Timer(self, wx.NewId())
- self.Bind(wx.EVT_BUTTON, self.OnStart, id=ID_Start)
- self.Bind(wx.EVT_BUTTON, self.OnStop, id=ID_Stop)
- self.Bind(wx.EVT_TIMER, self.OnTimer, id=ID_Timer)
- self.Bind(wx.EVT_TIMER, self.OnTimer2, id=ID_Timer2)
+ self.Bind(wx.EVT_BUTTON, self.OnStart, startBtn)
+ self.Bind(wx.EVT_BUTTON, self.OnStop, stopBtn)
+ self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
+ self.Bind(wx.EVT_TIMER, self.OnTimer2, self.timer2)
def OnStart(self, event):
self.timer.Start(1000)
overview = """\
-The wxTimer class allows you to execute code at specified intervals from
+The wx.Timer class allows you to execute code at specified intervals from
within the wxPython event loop. Timers can be one-shot or repeating.
"""
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
win = TestPanel(nb, log)
return win
else:
- dlg = wx.MessageDialog(frame, 'wxToggleButton is not available on this platform.',
+ dlg = wx.MessageDialog(frame, 'wx.ToggleButton is not available on this platform.',
'Sorry', wx.OK | wx.ICON_INFORMATION)
dlg.ShowModal()
dlg.Destroy()
overview = """\
-wxToggleButton is a button that stays pressed when clicked by the user.
+wx.ToggleButton is a button that stays pressed when clicked by the user.
In other words, it is similar to wxCheckBox in functionality but looks like a
wxButton.
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import images
overview = """\
-
+wx.ToolBar is a narrow strip of icons on one side of a frame (top, bottom, sides)
+that acts much like a menu does, except it is always visible. Additionally, actual
+wxWindows controls, such as wx.TextCtrl or wx.ComboBox, can be added to the toolbar
+and used from within it.
+
+Toolbar creation is a two-step process. First, the toolbar is defined using the
+various Add* methods of wx.ToolBar. Once all is set up, then wx.Toolbar.Realize()
+must be called to render it.
+
+wx.Toolbar events are also propogated as Menu events; this is especially handy when
+you have a menu bar that contains items that carry out the same function. For example,
+it is not uncommon to have a little 'floppy' toolbar icon to 'save' the current file
+(whatever it is) as well as a FILE/SAVE menu item that does the same thing. In this
+case, both events can be captured and acted upon using the same event handler
+with no ill effects.
+
+If there are cases where a toolbar icon should *not* be associated with a menu item,
+use a unique ID to trap it.
+
+There are a number of ways to create a toolbar for a wx.Frame. wx.Frame.CreateToolBar()
+does all the work except it adds no buttons at all unless you override the virtual method
+OnCreateToolBar(). On the other hand, you can just subclass wx.ToolBar and then use
+wx.Frame.SetToolBar() instead.
+
+Note that wx.TB_DOCKABLE is only supported under GTK. An attempt to alleviate this
+is provided in wx.lib.floatbar, but it is not formally supported.
"""
-# 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import string
import wx
overview = """\
-A tree control presents information as a hierarchy, with items that may be
+A TreeCtrl presents information as a hierarchy, with items that may be
expanded to show further items. Items in a tree control are referenced by
-wxTreeItemId handles.
+wx.TreeItemId handles.
"""
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import wx.gizmos as gizmos
overview = """<html><body>
-<h2><center>wxTreeListCtrl</center></h2>
+<h2><center>TreeListCtrl</center></h2>
-The wx.TreeListCtrl is essentially a wx.TreeCtrl with extra columns,
+The TreeListCtrl is essentially a wx.TreeCtrl with extra columns,
such that the look is similar to a wx.ListCtrl.
</body></html>
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
#----------------------------------------------------------------------
-# The wxVListBox is much like a regular wxListBox except you draw the
+# The wx.VListBox is much like a regular wx.ListBox except you draw the
# items yourself and the items can vary in height.
class MyVListBox(wx.VListBox):
overview = """<html><body>
-<h2><center>wxVListBox and wxHtmlListBox</center></h2>
+<h2><center>wx.VListBox and wx.HtmlListBox</center></h2>
<hr>
The "V" in wxVListBox stands for both "virtual" because it can have an
the same EVT_LISTBOX function to connect a handler.
<p>
-The wxHtmlListBox derives from wxVListBox, but draws each item itself
-as a wxHtmlCell. This means that you just need to provide a snippet
+The wx.HtmlListBox derives from wx.VListBox, but draws each item itself
+as a wx.HtmlCell. This means that you just need to provide a snippet
of HTML for each item when requested.
</body></html>
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import string
import wx
-
#----------------------------------------------------------------------
ALPHA_ONLY = 1
overview = """\
<html>
<body>
-wxValidator is the base class for a family of validator classes that mediate
+wx.Validator is the base class for a family of validator classes that mediate
between a class of control, and application data.
<p>A validator has three major roles:
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-# 11/3-/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o WizardPage* doesn't support GetId()
-#
import wx
-import wx.wizard as wiz
+import wx.wizard as wiz
import images
#----------------------------------------------------------------------
#----------------------------------------------------------------------
class TestPanel(wx.Panel):
- ID_wiz = wx.NewId()
-
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
b = wx.Button(self, -1, "Run Dynamic Wizard", pos=(50, 100))
self.Bind(wx.EVT_BUTTON, self.OnRunDynamicWizard, b)
- wiz.EVT_WIZARD_PAGE_CHANGED(self, self.ID_wiz, self.OnWizPageChanged)
- wiz.EVT_WIZARD_PAGE_CHANGING(self, self.ID_wiz, self.OnWizPageChanging)
- wiz.EVT_WIZARD_CANCEL(self, self.ID_wiz, self.OnWizCancel)
+ self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnWizPageChanged)
+ self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnWizPageChanging)
+ self.Bind(wiz.EVT_WIZARD_CANCEL, self.OnWizCancel)
def OnWizPageChanged(self, evt):
def OnRunSimpleWizard(self, evt):
# Create the wizard and the pages
- wizard = wiz.Wizard(self, self.ID_wiz, "Simple Wizard",
- images.getWizTest1Bitmap())
+ wizard = wiz.Wizard(self, -1, "Simple Wizard", images.getWizTest1Bitmap())
page1 = TitledPage(wizard, "Page 1")
page2 = TitledPage(wizard, "Page 2")
page3 = TitledPage(wizard, "Page 3")
#wizard.SetExtraStyle(wx.WIZARD_EX_HELPBUTTON)
#wizard.Create(self, self.ID_wiz, "Simple Wizard",
# images.getWizTest1Bitmap())
- wizard = wiz.Wizard(self, self.ID_wiz, "Simple Wizard",
- images.getWizTest1Bitmap())
+ wizard = wiz.Wizard(self, -1, "Simple Wizard", images.getWizTest1Bitmap())
page1 = TitledPage(wizard, "Page 1")
page2 = SkipNextPage(wizard, "Page 2")
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import sys
import wx
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import wx.xrc as xrc
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o There are issues using the wx namespace within the xrc code.
-#
-# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Error report: "Error: No handler found for XML node 'object',
-# class 'wx.StaticText'!"; no text shows on panel.
-#
import wx
import wx.xrc as xrc
<object class="MyBluePanel" name="MyPanel">
<size>200,100</size>
- <object class="wx.StaticText" name="label1">
+ <object class="wxStaticText" name="label1">
<label>This blue panel is a class derived from wx.Panel,\nand is loaded by a custom XmlResourceHandler.</label>
<pos>10,10</pos>
</object>
overview = """<html><body>
-<h2><center>wxXmlResourceHandler</center></h2>
+<h2><center>wx.XmlResourceHandler</center></h2>
-Deriving a class from wxXmlResourceHandler allows you to specify your
+Deriving a class from wx.XmlResourceHandler allows you to specify your
own classes in XRC resources, and your handler class will then be used
to create instances of that class when the resource is loaded.
-# 11/22/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
import wx
import wx.xrc as xrc
<object class="wxPanel" subclass="XmlResourceSubclass.MyBluePanel" name="MyPanel">
<size>200,100</size>
<object class="wxStaticText" name="label1">
- <label>This blue panel is a class derived from wxPanel
+ <label>This blue panel is a class derived from wx.Panel
and is loaded by a using a subclass attribute of the object tag.</label>
<pos>10,10</pos>
</object>
overview = """<html><body>
-<h2><center>wxXmlResourceSubclass</center></h2>
+<h2><center>wx.XmlResourceSubclass</center></h2>
Sometimes it is necessary to use custom classes, but you still want
them to be created from XRC. The subclass XRC attribute allows you to
-#!/usr/bin/env python
-#----------------------------------------------------------------------
-# 11/5/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Modified for wx namespace
-#
"""
This is a way to save the startup time when running img2py on lots of
-# 11/12/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-# o wx module doesn't like the doc string.
-#
-# 11/25/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Library didn't get hit by the wx renamer.
-# o Docstring issues resolved.
-#
import sys
-# 11/13/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
-
"""
Hello, and welcome to this test of the wxTreeItemData
class.
#!/usr/bin/env python
-#
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
-#
"""
Run wxPython in a second thread.
-# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
-#
-# o Updated for wx namespace
#
# This file is used for the wx.HtmlWindow demo.
#