diff --git a/demo/Calendar.py b/demo/Calendar.py index a66112d2..224e8270 100644 --- a/demo/Calendar.py +++ b/demo/Calendar.py @@ -443,6 +443,7 @@ class PrintCalend: def DoDrawing(self, DC): size = DC.GetSize() + DC.BeginDrawing() cal = wx.lib.calendar.PrtCalDraw(self) @@ -495,6 +496,8 @@ class PrintCalend: x = x + 4.0 # next column + DC.EndDrawing() + self.ymax = DC.MaxY() self.xmax = DC.MaxX() diff --git a/demo/DialogUnits.py b/demo/DialogUnits.py index 586f7f98..b8868a1d 100644 --- a/demo/DialogUnits.py +++ b/demo/DialogUnits.py @@ -49,8 +49,8 @@ class MyFrame(wx.Frame): wx.DLG_SZE(panel, (36, -1)), wx.TE_READONLY) - #print wx.DLG_PNT(panel, (24, 4)), wx.DLG_SZE(panel, (36, -1)) - #print wx.DLG_PNT(panel, (24, 16)),wx.DLG_SZE(panel, (36, -1)) + #print(wx.DLG_PNT(panel, (24, 4)), wx.DLG_SZE(panel, (36, -1))) + #print(wx.DLG_PNT(panel, (24, 16)),wx.DLG_SZE(panel, (36, -1))) # This method is called automatically when the CLOSE event is # sent to this window diff --git a/demo/ExpandoTextCtrl.py b/demo/ExpandoTextCtrl.py index b9ba3091..43c7699e 100644 --- a/demo/ExpandoTextCtrl.py +++ b/demo/ExpandoTextCtrl.py @@ -110,9 +110,9 @@ class TestFrame(wx.Frame): def OnOtherBtn(self, evt): # just for testing... - #print self.eom.numLines, + #print(self.eom.numLines) self.eom._adjustCtrl() - #print self.eom.numLines + #print(self.eom.numLines) #---------------------------------------------------------------------- diff --git a/demo/FindReplaceDialog.py b/demo/FindReplaceDialog.py index dbe6f697..4e334a2d 100644 --- a/demo/FindReplaceDialog.py +++ b/demo/FindReplaceDialog.py @@ -53,7 +53,7 @@ class TestPanel(wx.Panel): def OnFind(self, evt): - #print repr(evt.GetFindString()), repr(self.findData.GetFindString()) + #print(repr(evt.GetFindString()), repr(self.findData.GetFindString())) map = { wx.wxEVT_COMMAND_FIND : "FIND", wx.wxEVT_COMMAND_FIND_NEXT : "FIND_NEXT", diff --git a/demo/FloatCanvas.py b/demo/FloatCanvas.py index a8ec3272..dc9de9c1 100644 --- a/demo/FloatCanvas.py +++ b/demo/FloatCanvas.py @@ -4,7 +4,7 @@ try: import numpy as N import numpy.random as RandomArray haveNumpy = True - #print "Using numpy, version:", N.__version__ + #print("Using numpy, version:", N.__version__) except ImportError: # numpy isn't there haveNumpy = False @@ -438,7 +438,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import Canvas = self.Canvas Canvas.InitAll() - ## Random tests of everything: + ## Random tests of everything: colors = self.colors # Rectangles for i in range(3): @@ -540,7 +540,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.NumTimeSteps = 200 self.TimeStep = 1 self.Timer.Start(self.FrameDelay) - #print "Did %i frames in %f seconds"%(N, (time.time() - start) ) + #print("Did %i frames in %f seconds"%(N, (time.time() - start) )) def TestHitTest(self, event=None): wx.GetApp().Yield(True) @@ -1302,14 +1302,14 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.Log("Loading Map from a File") wx.GetApp().Yield(True) # so log text will get displayed now. Shorelines = self.Read_MapGen(os.path.join("data",'world.dat'),stats = 0) - #print "It took %f seconds to load %i shorelines"%(time.clock() - start,len(Shorelines) ) + #print("It took %f seconds to load %i shorelines"%(time.clock() - start,len(Shorelines) )) #start = time.clock() for segment in Shorelines: self.Canvas.AddLine(segment) - #print "It took %f seconds to add %i shorelines"%(time.clock() - start,len(Shorelines) ) + #print("It took %f seconds to add %i shorelines"%(time.clock() - start,len(Shorelines) )) #start = time.clock() self.Canvas.ZoomToBB() - #print "It took %f seconds to draw %i shorelines"%(time.clock() - start,len(Shorelines) ) + #print("It took %f seconds to draw %i shorelines"%(time.clock() - start,len(Shorelines) )) @@ -1336,10 +1336,10 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import linecolors.append(random.randint(0,len(colors)-1) ) for (points,color,width) in zip(linepoints,linecolors,linewidths): Canvas.AddLine((points[0:2],points[2:4]), LineWidth = width, LineColor = colors[color]) - #print "It took %f seconds to add %i lines"%(time.clock() - start,len(linepoints) ) + #print("It took %f seconds to add %i lines"%(time.clock() - start,len(linepoints) )) #start = time.clock() Canvas.ZoomToBB() - #print "It took %f seconds to draw %i lines"%(time.clock() - start,len(linepoints) ) + #print("It took %f seconds to draw %i lines"%(time.clock() - start,len(linepoints) )) def ArrowLineTest(self,event = None): wx.GetApp().Yield(True) @@ -1384,11 +1384,11 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import for i in range(1000): Point = (random.uniform(BigRange[0],BigRange[1]),random.uniform(BigRange[0],BigRange[1])) coords.append( (Point) ) - print "Drawing the Points" + print("Drawing the Points") start = time.clock() for Point in coords: Canvas.AddPoint(Point, Diameter = 4) - print "It took %s seconds to add the points"%(time.clock() - start) + print("It took %s seconds to add the points"%(time.clock() - start)) Canvas.ZoomToBB() def PropertiesChangeTest(self,event=None): @@ -1571,7 +1571,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.Log("The Arrow was Clicked") def RotateArrow(self,event): - ##print "The Changeable Arrow was Clicked" + ##print("The Changeable Arrow was Clicked") ## You can do them either one at a time, or both at once ## Doing them both at once prevents the arrow points from being calculated twice #self.RotArrow.SetDirection(self.RotArrow.Direction + random.uniform(-90,90)) @@ -1742,8 +1742,8 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import for segment in Shorelines: NumPoints = NumPoints + len(segment) AvgPoints = NumPoints / NumSegments - print "Number of Segments: ", NumSegments - print "Average Number of Points per segment: ",AvgPoints + print("Number of Segments: ", NumSegments) + print("Average Number of Points per segment: ", AvgPoints) if AllLines: Lines = [] for segment in Shorelines: diff --git a/demo/GridBagSizer.py b/demo/GridBagSizer.py index b181ea9d..a55b9cea 100644 --- a/demo/GridBagSizer.py +++ b/demo/GridBagSizer.py @@ -115,9 +115,9 @@ assert when compiled in debug mode.""", pt = evt.GetPosition() item = self.gbs.FindItemAtPoint(pt) if item is None: - print "no item at", `pt` + print("no item at", `pt`) else: - print "item found: ", `item.GetPos()`, "--", `item.GetSpan()` + print("item found: ", `item.GetPos()`, "--", `item.GetSpan()`) #--------------------------------------------------------------------------- diff --git a/demo/GridCustTable.py b/demo/GridCustTable.py index 17ec48d2..610ba090 100644 --- a/demo/GridCustTable.py +++ b/demo/GridCustTable.py @@ -4,9 +4,9 @@ import wx.grid as gridlib #--------------------------------------------------------------------------- -class CustomDataTable(gridlib.PyGridTableBase): +class CustomDataTable(gridlib.GridTableBase): def __init__(self, log): - gridlib.PyGridTableBase.__init__(self) + gridlib.GridTableBase.__init__(self) self.log = log self.colLabels = ['ID', 'Description', 'Severity', 'Priority', 'Platform', @@ -72,7 +72,7 @@ class CustomDataTable(gridlib.PyGridTableBase): ) self.GetView().ProcessTableMessage(msg) - innerSetValue(row, col, value) + innerSetValue(row, col, value) #-------------------------------------------------- # Some optional methods @@ -101,13 +101,9 @@ class CustomDataTable(gridlib.PyGridTableBase): return self.CanGetValueAs(row, col, typeName) - - - #--------------------------------------------------------------------------- - class CustTableGrid(gridlib.Grid): def __init__(self, parent, log): gridlib.Grid.__init__(self, parent, -1) @@ -154,17 +150,17 @@ class TestFrame(wx.Frame): p.SetSizer(bs) def OnButton(self, evt): - print "button selected" + print("button selected") def OnButtonFocus(self, evt): - print "button focus" + print("button focus") #--------------------------------------------------------------------------- if __name__ == '__main__': import sys - app = wx.PySimpleApp() + app = wx.App() frame = TestFrame(None, sys.stdout) frame.Show(True) app.MainLoop() diff --git a/demo/GridHugeTable.py b/demo/GridHugeTable.py index cd5d2e25..746ea07d 100644 --- a/demo/GridHugeTable.py +++ b/demo/GridHugeTable.py @@ -61,8 +61,8 @@ class HugeTableGrid(gridlib.Grid): self.Bind(gridlib.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightDown) def OnRightDown(self, event): - print "hello" - print self.GetSelectedRows() + print("hello") + print(self.GetSelectedRows()) #--------------------------------------------------------------------------- diff --git a/demo/Grid_MegaExample.py b/demo/Grid_MegaExample.py index 418976a5..8eeb48e4 100644 --- a/demo/Grid_MegaExample.py +++ b/demo/Grid_MegaExample.py @@ -116,7 +116,7 @@ class MegaTable(Grid.GridTableBase): # ------------------------------------------------------ # begin the added code to manipulate the table (non wx related) def AppendRow(self, row): - #print 'append' + #print('append') entry = {} for name in self.colnames: diff --git a/demo/KeyEvents.py b/demo/KeyEvents.py index 603cc528..4404cfe8 100644 --- a/demo/KeyEvents.py +++ b/demo/KeyEvents.py @@ -296,7 +296,7 @@ class KeyLog(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin): self.SetItem(id, 6, str(evt.GetRawKeyCode())) self.SetItem(id, 7, str(evt.GetRawKeyFlags())) - #print ( id, evType, keyname, str(keycode), modifiers, str(evt.GetRawKeyCode()), str(evt.GetRawKeyFlags())) + #print(id, evType, keyname, str(keycode), modifiers, str(evt.GetRawKeyCode()), str(evt.GetRawKeyFlags())) self.EnsureVisible(id) diff --git a/demo/ListCtrl.py b/demo/ListCtrl.py index 75dd4423..df1b3d5f 100644 --- a/demo/ListCtrl.py +++ b/demo/ListCtrl.py @@ -228,7 +228,7 @@ class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin): return item.GetText() def OnItemSelected(self, event): - ##print event.GetItem().GetTextColour() + ##print(event.GetItem().GetTextColour()) self.currentItem = event.Index self.log.WriteText("OnItemSelected: %s, %s, %s, %s\n" % (self.currentItem, diff --git a/demo/Pickers.py b/demo/Pickers.py index e6dfaffb..c810a2ec 100644 --- a/demo/Pickers.py +++ b/demo/Pickers.py @@ -13,7 +13,7 @@ class TestPanel(wx.Panel): title.SetFont(wx.FFont(24, wx.FONTFAMILY_SWISS, wx.FONTFLAG_BOLD)) title.SetForegroundColour("navy") box.Add(title, 0, wx.ALIGN_CENTER|wx.ALL, 5) - #print title.GetBestSize(), title.GetMinSize(), title.GetSize() + #print(title.GetBestSize(), title.GetMinSize(), title.GetSize()) box.Add(wx.StaticLine(self), 0, wx.EXPAND) diff --git a/demo/PlateButton.py b/demo/PlateButton.py index 7aeabb48..8b17926f 100644 --- a/demo/PlateButton.py +++ b/demo/PlateButton.py @@ -253,7 +253,7 @@ class TestLog: pass def write(self, msg): - print msg + print(msg) #---------------------------------------------------------------------- diff --git a/demo/Process.py b/demo/Process.py index ad6827cc..2ea9fe78 100644 --- a/demo/Process.py +++ b/demo/Process.py @@ -92,9 +92,9 @@ class TestPanel(wx.Panel): def OnCloseStream(self, evt): self.log.write('OnCloseStream\n') - #print "b4 CloseOutput" + #print("b4 CloseOutput") self.process.CloseOutput() - #print "after CloseOutput" + #print("after CloseOutput") def OnIdle(self, evt): if self.process is not None: diff --git a/demo/PythonEvents.py b/demo/PythonEvents.py index b65a9183..7987ab9a 100644 --- a/demo/PythonEvents.py +++ b/demo/PythonEvents.py @@ -32,7 +32,7 @@ class MyEvent(wx.PyCommandEvent): self.myVal = None #def __del__(self): - # print '__del__' + # print('__del__') # wx.PyCommandEvent.__del__(self) def SetMyVal(self, val): @@ -51,9 +51,9 @@ class MyButton(wx.Button): pt = event.GetPosition() evt = MyEvent(myEVT_BUTTON_CLICKPOS, self.GetId()) evt.SetMyVal(pt) - #print id(evt), sys.getrefcount(evt) + #print(id(evt), sys.getrefcount(evt)) self.GetEventHandler().ProcessEvent(evt) - #print id(evt), sys.getrefcount(evt) + #print(id(evt), sys.getrefcount(evt)) event.Skip() @@ -79,7 +79,7 @@ class TestPanel(wx.Panel): self.log.WriteText("OnClick\n") def OnMyEvent(self, event): - #print id(event), sys.getrefcount(event) + #print(id(event), sys.getrefcount(event)) self.log.WriteText("MyEvent: %s\n" % (event.GetMyVal(), ) ) diff --git a/demo/ScrolledWindow.py b/demo/ScrolledWindow.py index 2460550e..42cac6c4 100644 --- a/demo/ScrolledWindow.py +++ b/demo/ScrolledWindow.py @@ -142,7 +142,6 @@ class MyCanvas(wx.ScrolledWindow): "red", "blue", (25,25)) self.DrawSavedLines(dc) - def DrawSavedLines(self, dc): dc.SetPen(wx.Pen('MEDIUM FOREST GREEN', 4)) for line in self.lines: @@ -218,7 +217,7 @@ class MyCanvas(wx.ScrolledWindow): ## delta = evt.GetWheelDelta() ## rot = evt.GetWheelRotation() ## linesPer = evt.GetLinesPerAction() -## print delta, rot, linesPer +## print(delta, rot, linesPer) ## ws = self.wheelScroll ## ws = ws + rot ## lines = ws / delta diff --git a/demo/StyledTextCtrl_2.py b/demo/StyledTextCtrl_2.py index 1bf3bac6..37d98d06 100644 --- a/demo/StyledTextCtrl_2.py +++ b/demo/StyledTextCtrl_2.py @@ -202,7 +202,7 @@ class PythonSTC(stc.StyledTextCtrl): #for x in range(50000): # lst.append('%05d' % x) #st = " ".join(lst) - #print len(st) + #print(len(st)) #self.AutoCompShow(0, st) kw = keyword.kwlist[:] @@ -259,7 +259,7 @@ class PythonSTC(stc.StyledTextCtrl): self.BraceHighlight(braceAtCaret, braceOpposite) #pt = self.PointFromPosition(braceOpposite) #self.Refresh(True, wxRect(pt.x, pt.y, 5,5)) - #print pt + #print(pt) #self.Refresh(False) diff --git a/demo/SystemSettings.py b/demo/SystemSettings.py index 52372bfd..71ace714 100644 --- a/demo/SystemSettings.py +++ b/demo/SystemSettings.py @@ -306,7 +306,7 @@ class TestLog: pass def write(self, msg): - print msg + print(msg) #---------------------------------------------------------------------- diff --git a/demo/TextCtrl.py b/demo/TextCtrl.py index 2e467984..e8660cd7 100644 --- a/demo/TextCtrl.py +++ b/demo/TextCtrl.py @@ -6,13 +6,13 @@ import wx class TestPanel(wx.Panel): # def OnSetFocus(self, evt): - # print "OnSetFocus" + # print("OnSetFocus") # evt.Skip() # def OnKillFocus(self, evt): - # print "OnKillFocus" + # print("OnKillFocus") # evt.Skip() # def OnWindowDestroy(self, evt): - # print "OnWindowDestroy" + # print("OnWindowDestroy") # evt.Skip() diff --git a/demo/TimeCtrl.py b/demo/TimeCtrl.py index 6574c68f..3635e3c4 100644 --- a/demo/TimeCtrl.py +++ b/demo/TimeCtrl.py @@ -205,7 +205,7 @@ class TestPanel( scrolled.ScrolledPanel ): min, max = None, None cur_min, cur_max = self.target_ctrl.GetBounds() - print cur_min, min + print(cur_min, min) if min and (min != cur_min): self.target_ctrl.SetMin( min ) if max and (max != cur_max): self.target_ctrl.SetMax( max ) diff --git a/demo/TreeCtrl.py b/demo/TreeCtrl.py index 528ca905..b871e92f 100644 --- a/demo/TreeCtrl.py +++ b/demo/TreeCtrl.py @@ -166,7 +166,7 @@ class TestTreeCtrlPanel(wx.Panel): self.log.WriteText("BoundingRect: %s\n" % self.tree.GetBoundingRect(self.item, True)) #items = self.tree.GetSelections() - #print map(self.tree.GetItemText, items) + #print(map(self.tree.GetItemText, items)) event.Skip() def OnActivate(self, event): diff --git a/demo/UIActionSimulator.py b/demo/UIActionSimulator.py index a1513a71..f3b1b4b5 100644 --- a/demo/UIActionSimulator.py +++ b/demo/UIActionSimulator.py @@ -88,7 +88,7 @@ class TestPanel(wx.Panel): def _setNextKeyEvent(self): evtType, key, modifiers, milli = self._playbackEvents.pop(0) milli = max(milli/2, 1) # play back faster than it was recorded - print (evtType, key, modifiers, milli) + print(evtType, key, modifiers, milli) wx.CallLater(milli, self._playbackKey, evtType, key, modifiers) diff --git a/demo/XMLtreeview.py b/demo/XMLtreeview.py index 36dc81f6..4071c668 100644 --- a/demo/XMLtreeview.py +++ b/demo/XMLtreeview.py @@ -44,11 +44,11 @@ class XMLTree(wx.TreeCtrl): self.draggingItem = None if not itemDst.IsOk(): - print "Can't drag to here..." + print("Can't drag to here...") return if self.IsDescendant(itemDst, itemSrc): - print "Can't move item to its descendant" + print("Can't move item to its descendant") return # For this simple example just take the text of the source item diff --git a/demo/agw/ListCtrl.py b/demo/agw/ListCtrl.py index 002ae932..8bad4634 100644 --- a/demo/agw/ListCtrl.py +++ b/demo/agw/ListCtrl.py @@ -335,8 +335,8 @@ class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin): def OnPopupOne(self, event): self.log.WriteText("Popup one\n") - print "FindItem:", self.list.FindItem(-1, "Roxette") - print "FindItemData:", self.list.FindItemData(-1, 11) + print("FindItem:", self.list.FindItem(-1, "Roxette")) + print("FindItemData:", self.list.FindItemData(-1, 11)) def OnPopupTwo(self, event): self.log.WriteText("Selected items:\n") @@ -356,7 +356,7 @@ class TestListCtrlPanel(wx.Panel, listmix.ColumnSorterMixin): def OnPopupFive(self, event): item = self.list.GetItem(self.currentItem) - print item.Text, item.Id, self.list.GetItemData(self.currentItem) + print(item.Text, item.Id, self.list.GetItemData(self.currentItem)) def OnPopupSix(self, event): self.list.EditLabel(self.currentItem) diff --git a/demo/agw/run.py b/demo/agw/run.py index 94f66a3b..9ea61e05 100644 --- a/demo/agw/run.py +++ b/demo/agw/run.py @@ -23,8 +23,8 @@ import wx.lib.mixins.inspection import sys, os # stuff for debugging -print "wx.version:", wx.version() -print "pid:", os.getpid() +print("wx.version:", wx.version()) +print("pid:", os.getpid()) ##raw_input("Press Enter...") assertMode = wx.PYAPP_ASSERT_DIALOG @@ -145,7 +145,7 @@ def main(argv): break if len(argv) < 2: - print "Please specify a demo module name on the command-line" + print("Please specify a demo module name on the command-line") raise SystemExit name, ext = os.path.splitext(argv[1]) diff --git a/demo/run.py b/demo/run.py index 32d72798..26641229 100755 --- a/demo/run.py +++ b/demo/run.py @@ -23,10 +23,10 @@ import wx.lib.mixins.inspection import sys, os # stuff for debugging -print("Python " + sys.version) -print("wx.version: " + wx.version()) -print("pid: " + str(os.getpid())) -##print "executable:", sys.executable; raw_input("Press Enter...") +print("Python", sys.version) +print("wx.version:", wx.version()) +print("pid:", os.getpid()) +##print("executable:", sys.executable; raw_input("Press Enter...")) assertMode = wx.APP_ASSERT_DIALOG ##assertMode = wx.APP_ASSERT_EXCEPTION @@ -146,16 +146,17 @@ def main(argv): break if len(argv) < 2: - print "Please specify a demo module name on the command-line" + print("Please specify a demo module name on the command-line") raise SystemExit # ensure the CWD is the demo folder demoFolder = os.path.dirname(__file__) os.chdir(demoFolder) - + name, ext = os.path.splitext(argv[1]) module = __import__(name) + app = RunDemoApp(name, module, useShell) app.MainLoop()