mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 03:20:08 +01:00
PR 44 (modified): fixes print statements/functions in samples.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@75629 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,7 +2,7 @@ import sys
|
||||
import wx
|
||||
import wx.dataview as dv
|
||||
|
||||
#import os; print 'PID:', os.getpid(); raw_input("Press enter...")
|
||||
#import os; print('PID:'+str(os.getpid())); raw_input("Press enter...")
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ this is very old-style code: don't imitate it!
|
||||
|
||||
from time import clock
|
||||
import wx
|
||||
print wx.VERSION_STRING
|
||||
print(wx.VERSION_STRING)
|
||||
from numpy import *
|
||||
|
||||
## import local version:
|
||||
@@ -21,7 +21,7 @@ ver = 'installed'
|
||||
if ver == 'installed': ## import the installed version
|
||||
from wx.lib.floatcanvas import NavCanvas
|
||||
from wx.lib.floatcanvas import FloatCanvas
|
||||
print "using installed version:", wx.lib.floatcanvas.__version__
|
||||
print("using installed version: %s" % wx.lib.floatcanvas.__version__)
|
||||
elif ver == 'local':
|
||||
## import a local version
|
||||
import sys
|
||||
@@ -99,8 +99,8 @@ class DrawFrame(wx.Frame):
|
||||
return None
|
||||
|
||||
def RightButtonEvent(self,event):
|
||||
print "Right Button has been clicked in DrawFrame"
|
||||
print "coords are: %i, %i"%(event.GetX(),event.GetY())
|
||||
print("Right Button has been clicked in DrawFrame")
|
||||
print("coords are: %i, %i"%(event.GetX(),event.GetY()))
|
||||
event.Skip()
|
||||
|
||||
def OnAbout(self, event):
|
||||
@@ -163,7 +163,7 @@ class DrawFrame(wx.Frame):
|
||||
InForeground = False)
|
||||
|
||||
## Pointset
|
||||
print "Adding Points to Foreground"
|
||||
print("Adding Points to Foreground" )
|
||||
for i in range(1):
|
||||
points = RandomArray.uniform(-100,100,(1000,2))
|
||||
D = 2
|
||||
@@ -183,7 +183,7 @@ class DrawFrame(wx.Frame):
|
||||
self.LEs.SetPoints(points)
|
||||
self.Canvas.Draw()
|
||||
wx.GetApp().Yield(True)
|
||||
print "running the movie took %f seconds"%(clock() - start)
|
||||
print("running the movie took %f seconds"%(clock() - start))
|
||||
|
||||
class DemoApp(wx.App):
|
||||
"""
|
||||
@@ -277,8 +277,8 @@ def Read_MapGen(filename,stats = False):
|
||||
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)
|
||||
|
||||
return Shorelines
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ class DrawFrame(wx.Frame):
|
||||
Canvas.ZoomToBB()
|
||||
|
||||
def OnLeft(self, object):
|
||||
print "Rect %s got hit"%object.Name
|
||||
print("Rect %s got hit"%object.Name)
|
||||
|
||||
def OnMove(self, event):
|
||||
"""
|
||||
|
||||
@@ -57,7 +57,7 @@ class BNAData:
|
||||
file.write("%.12f,%.12f\n"%(tuple(p)))
|
||||
|
||||
def Load(self, filename):
|
||||
#print "Loading:", filename
|
||||
#print("Loading:", filename)
|
||||
file = open(filename,'rU')
|
||||
|
||||
self.Filename = filename
|
||||
@@ -279,7 +279,7 @@ class DrawFrame(wx.Frame):
|
||||
try:
|
||||
AllPolys = []
|
||||
self.BNAFile = BNAData(filename)
|
||||
print "loaded BNAFile:", self.BNAFile.Filename
|
||||
print("loaded BNAFile:", self.BNAFile.Filename)
|
||||
for i, shoreline in enumerate(self.BNAFile.PointsData):
|
||||
Poly = self.Canvas.AddPolygon(shoreline,
|
||||
LineWidth = 1,
|
||||
|
||||
@@ -19,7 +19,7 @@ ver = 'installed'
|
||||
if ver == 'installed': ## import the installed version
|
||||
from wx.lib.floatcanvas import NavCanvas
|
||||
from wx.lib.floatcanvas import FloatCanvas
|
||||
print "using installed version:", wx.lib.floatcanvas.__version__
|
||||
print("using installed version:", wx.lib.floatcanvas.__version__)
|
||||
elif ver == 'local':
|
||||
## import a local version
|
||||
import sys
|
||||
@@ -134,7 +134,7 @@ class DrawFrame(wx.Frame):
|
||||
wx.CallAfter(Canvas.ZoomToBB)
|
||||
|
||||
def BallHit(self, object):
|
||||
print "the ball was clicked"
|
||||
print("the ball was clicked")
|
||||
self.Ball.Moving = True
|
||||
|
||||
def OnMove(self, event):
|
||||
|
||||
@@ -105,7 +105,7 @@ class DrawFrame(wx.Frame):
|
||||
Prints various info about the state of the canvas to stdout
|
||||
|
||||
"""
|
||||
print "Scale is:", self.Canvas.Scale
|
||||
print("Scale is:", self.Canvas.Scale)
|
||||
|
||||
|
||||
app = wx.App(False)
|
||||
|
||||
@@ -75,19 +75,19 @@ class DrawFrame(wx.Frame):
|
||||
Canvas.ZoomToBB()
|
||||
|
||||
def SquareHitLeft(self, square):
|
||||
print "square hit:", square.indexes
|
||||
print("square hit:", square.indexes)
|
||||
# set a random color
|
||||
c = random.sample(colors, 1)[0]
|
||||
square.SetFillColor( c )
|
||||
self.Canvas.Draw(True)
|
||||
|
||||
def SquareEnter(self, square):
|
||||
print "entering square:", square.indexes
|
||||
print("entering square:", square.indexes)
|
||||
square.outline.SetLineStyle("Solid")
|
||||
self.Canvas.Draw(True)
|
||||
|
||||
def SquareLeave(self, square):
|
||||
print "leaving square:", square.indexes
|
||||
print("leaving square:", square.indexes)
|
||||
square.outline.SetLineStyle(None)
|
||||
self.Canvas.Draw(True)
|
||||
|
||||
@@ -97,7 +97,7 @@ class DrawFrame(wx.Frame):
|
||||
re-zooms the canvas to fit the window
|
||||
|
||||
"""
|
||||
print "in OnSize"
|
||||
print("in OnSize")
|
||||
self.Canvas.ZoomToBB()
|
||||
event.Skip()
|
||||
|
||||
|
||||
@@ -20,10 +20,10 @@ try: # see if there is a local FloatCanvas to use
|
||||
import sys
|
||||
sys.path.append("../")
|
||||
from floatcanvas import NavCanvas, FloatCanvas
|
||||
print "Using local FloatCanvas"
|
||||
print("Using local FloatCanvas")
|
||||
except ImportError: # Use the wxPython lib one
|
||||
from wx.lib.floatcanvas import NavCanvas, FloatCanvas
|
||||
print "Using installed FloatCanvas"
|
||||
print("Using installed FloatCanvas")
|
||||
|
||||
|
||||
class DrawFrame(wx.Frame):
|
||||
|
||||
@@ -91,13 +91,13 @@ class DrawFrame(wx.Frame):
|
||||
self.SetStatusText("%.2f, %.2f"%tuple(event.Coords))
|
||||
|
||||
def RemoveGroup(self, evt, group=""):
|
||||
print "removing group:", group
|
||||
print("removing group:", group)
|
||||
G = self.Groups[group]
|
||||
self.Canvas.RemoveObject(G)
|
||||
self.Canvas.Draw(Force=True)
|
||||
|
||||
def ReplaceGroup(self, evt, group=""):
|
||||
print "replacing group:", group
|
||||
print("replacing group:", group)
|
||||
G = self.Groups[group]
|
||||
self.Canvas.AddObject(G)
|
||||
self.Canvas.Draw(Force=True)
|
||||
|
||||
@@ -74,7 +74,7 @@ class DrawFrame(wx.Frame):
|
||||
for Group in self.Groups.keys():
|
||||
Button = wx.Button(tb, wx.ID_ANY, "Hide/Show%s"%Group)
|
||||
tb.AddControl(Button)
|
||||
print Group
|
||||
print(Group)
|
||||
Button.Bind(wx.EVT_BUTTON, lambda evt, group=Group: self.HideGroup(evt, group))
|
||||
tb.Realize()
|
||||
|
||||
|
||||
@@ -42,18 +42,18 @@ class DrawFrame(wx.Frame):
|
||||
self.MakeHexagons()
|
||||
|
||||
self.Show(True)
|
||||
print "Drawing the Hexagons"
|
||||
print("Drawing the Hexagons")
|
||||
self.Canvas.ZoomToBB()
|
||||
|
||||
return None
|
||||
|
||||
def MakeHexagons(self):
|
||||
print "Building %i Hexagons"%NumHexagons
|
||||
print("Building %i Hexagons"%NumHexagons)
|
||||
# get a list of colors for random colors
|
||||
|
||||
wx.lib.colourdb.updateColourDB()
|
||||
self.colors = wx.lib.colourdb.getColourList()
|
||||
print "Max colors:", len(self.colors)
|
||||
print("Max colors:", len(self.colors))
|
||||
Canvas = self.Canvas
|
||||
D = 1.0
|
||||
h = D *N.sqrt(3)/2
|
||||
@@ -68,19 +68,19 @@ class DrawFrame(wx.Frame):
|
||||
for center in Centers:
|
||||
# scale the hexagon
|
||||
Points = Hex * uniform(5,20)
|
||||
#print Points
|
||||
#print(Points)
|
||||
# shift the hexagon
|
||||
Points = Points + center
|
||||
#print Points
|
||||
#print(Points)
|
||||
cf = random.randint(0,len(self.colors)-1)
|
||||
#cf = 55
|
||||
H = Canvas.AddPolygon(Points, LineColor = None, FillColor = self.colors[cf])
|
||||
#print "BrushList is: %i long"%len(H.BrushList)
|
||||
#print("BrushList is: %i long"%len(H.BrushList))
|
||||
H.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.HexHit)
|
||||
print "BrushList is: %i long"%len(H.BrushList)
|
||||
print("BrushList is: %i long"%len(H.BrushList))
|
||||
|
||||
def HexHit(self, Hex):
|
||||
print "A %s Hex was hit, obj ID: %i"%(Hex.FillColor, id(Hex))
|
||||
print("A %s Hex was hit, obj ID: %i"%(Hex.FillColor, id(Hex)))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -55,9 +55,9 @@ class DrawFrame(wx.Frame):
|
||||
self.Canvas.MaxScale = 1.0
|
||||
|
||||
def Binding(self, event):
|
||||
print "Writing a png file:"
|
||||
print("Writing a png file:")
|
||||
self.Canvas.SaveAsImage("junk.png")
|
||||
print "Writing a jpeg file:"
|
||||
print("Writing a jpeg file:")
|
||||
self.Canvas.SaveAsImage("junk.jpg",wx.BITMAP_TYPE_JPEG)
|
||||
|
||||
def OnMove(self, event):
|
||||
|
||||
@@ -183,7 +183,7 @@ class DrawFrame(wx.Frame):
|
||||
self.Canvas.ZoomToBB()
|
||||
|
||||
def MoveTest(self,event=None):
|
||||
print "Running: TestHitTestForeground"
|
||||
print("Running: TestHitTestForeground")
|
||||
wx.GetApp().Yield()
|
||||
|
||||
self.UnBindAllMouseEvents()
|
||||
|
||||
@@ -39,7 +39,7 @@ class TestFrame(wx.Frame):
|
||||
wx.CallAfter(self.canvas.ZoomToBB)
|
||||
|
||||
def OnLeftDown(self, event):
|
||||
print 'Left Button clicked at:', event.Coords
|
||||
print('Left Button clicked at: %s' % event.Coords)
|
||||
|
||||
frame = TestFrame(None, title="Mouse Event Tester")
|
||||
#self.SetTopWindow(frame)
|
||||
|
||||
@@ -17,7 +17,7 @@ if ver == 'installed': ## import the installed version
|
||||
from wx.lib.floatcanvas import NavCanvas, Resources
|
||||
from wx.lib.floatcanvas import FloatCanvas as FC
|
||||
from wx.lib.floatcanvas.Utilities import BBox
|
||||
print "using installed version:", wx.lib.floatcanvas.__version__
|
||||
print("using installed version: %s" % wx.lib.floatcanvas.__version__)
|
||||
elif ver == 'local':
|
||||
## import a local version
|
||||
import sys
|
||||
|
||||
@@ -13,7 +13,7 @@ ver = 'installed'
|
||||
if ver == 'installed': ## import the installed version
|
||||
from wx.lib.floatcanvas import NavCanvas, Resources
|
||||
from wx.lib.floatcanvas import FloatCanvas as FC
|
||||
print "using installed version:", wx.lib.floatcanvas.__version__
|
||||
print("using installed version: %s" % wx.lib.floatcanvas.__version__)
|
||||
elif ver == 'local':
|
||||
## import a local version
|
||||
import sys
|
||||
@@ -125,7 +125,7 @@ class DrawFrame(wx.Frame):
|
||||
self.Moving = False
|
||||
|
||||
def TriHit(self, object):
|
||||
print "In TriHit"
|
||||
print("In TriHit")
|
||||
if not self.Moving:
|
||||
self.Moving = True
|
||||
self.StartPoint = object.HitCoordsPixel
|
||||
|
||||
@@ -69,9 +69,9 @@ class DrawFrame(wx.Frame):
|
||||
self.SetStatusText("%.2f, %.2f"%tuple(event.Coords))
|
||||
|
||||
def Binding(self, event):
|
||||
print "Writing a png file:"
|
||||
print("Writing a png file:")
|
||||
self.Canvas.SaveAsImage("junk.png")
|
||||
print "Writing a jpeg file:"
|
||||
print("Writing a jpeg file:")
|
||||
self.Canvas.SaveAsImage("junk.jpg",wx.BITMAP_TYPE_JPEG)
|
||||
|
||||
|
||||
|
||||
@@ -38,6 +38,6 @@ Canvas.AddRectangle((1,10.5), (6,8.5))
|
||||
Canvas.ZoomToBB()
|
||||
|
||||
|
||||
print "Saving the image:", "junk.png"
|
||||
print("Saving the image: junk.png")
|
||||
Canvas.SaveAsImage("junk.png")
|
||||
|
||||
|
||||
@@ -74,10 +74,10 @@ class DrawFrame(wx.Frame):
|
||||
Canvas.ZoomToBB()
|
||||
|
||||
def Pie1Hit(self, obj):
|
||||
print "Pie1 hit!"
|
||||
print("Pie1 hit!")
|
||||
|
||||
def Pie2Hit(self, obj):
|
||||
print "Pie2 hit!"
|
||||
print("Pie2 hit!")
|
||||
|
||||
def OnMove(self, event):
|
||||
"""
|
||||
|
||||
@@ -48,20 +48,20 @@ class DrawFrame(wx.Frame):
|
||||
Canvas.ZoomToBB()
|
||||
|
||||
def OnOverPoints(self, obj):
|
||||
print "Mouse over point: ", obj.FindClosestPoint(obj.HitCoords)
|
||||
print("Mouse over point: %s" % obj.FindClosestPoint(obj.HitCoords))
|
||||
|
||||
def OnLeavePoints(self, obj):
|
||||
print "Mouse left point: ", obj.FindClosestPoint(obj.HitCoords)
|
||||
print("Mouse left point: %s" % obj.FindClosestPoint(obj.HitCoords))
|
||||
|
||||
def OnLeftDown(self, obj):
|
||||
print "Mouse left down on point: ", obj.FindClosestPoint(obj.HitCoords)
|
||||
print("Mouse left down on point: %s" % obj.FindClosestPoint(obj.HitCoords))
|
||||
|
||||
def OnMove(self, event):
|
||||
"""
|
||||
Updates the status bar with the world coordinates
|
||||
|
||||
"""
|
||||
self.SetStatusText("%.2f, %.2f"%tuple(event.Coords))
|
||||
self.SetStatusText("%.2f, %.2f" % tuple(event.Coords))
|
||||
|
||||
app = wx.App(False)
|
||||
F = DrawFrame(None, title="FloatCanvas Demo App", size=(700,700) )
|
||||
|
||||
@@ -198,7 +198,7 @@ class DrawFrame(wx.Frame):
|
||||
|
||||
def SelectPointHit(self, PointSet):
|
||||
PointSet.Index = PointSet.FindClosestPoint(PointSet.HitCoords)
|
||||
print "point #%i hit"%PointSet.Index
|
||||
print("point #%i hit"%PointSet.Index)
|
||||
#Index = PointSet.Index
|
||||
self.PointSelected = True
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ if ver == 'installed': ## import the installed version
|
||||
from wx.lib.floatcanvas import NavCanvas, Resources
|
||||
from wx.lib.floatcanvas import FloatCanvas as FC
|
||||
from wx.lib.floatcanvas.Utilities import BBox
|
||||
print "using installed version:", wx.lib.floatcanvas.__version__
|
||||
print("using installed version: %s" % wx.lib.floatcanvas.__version__)
|
||||
elif ver == 'local':
|
||||
## import a local version
|
||||
import sys
|
||||
|
||||
@@ -72,7 +72,7 @@ class DrawFrame(wx.Frame):
|
||||
self.Canvas.ZoomToBB()
|
||||
|
||||
def OnAbout(self, event):
|
||||
print "OnAbout called"
|
||||
print("OnAbout called")
|
||||
|
||||
dlg = wx.MessageDialog(self, "This is a small program to demonstrate\n"
|
||||
"the use of the FloatCanvas\n",
|
||||
|
||||
@@ -279,10 +279,10 @@ class DrawFrame(wx.Frame):
|
||||
|
||||
|
||||
def binding(self, event):
|
||||
print "I'm the Rectangle"
|
||||
print("I'm the Rectangle")
|
||||
|
||||
def binding2(self, event):
|
||||
print "I'm the TextBox"
|
||||
print("I'm the TextBox")
|
||||
|
||||
app = wx.App()
|
||||
DrawFrame(None, -1, "FloatCanvas Demo App", wx.DefaultPosition, (700,700) )
|
||||
|
||||
@@ -16,7 +16,7 @@ if ver == 'installed': ## import the installed version
|
||||
from wx.lib.floatcanvas import NavCanvas, Resources
|
||||
from wx.lib.floatcanvas import FloatCanvas as FC
|
||||
from wx.lib.floatcanvas.Utilities import BBox
|
||||
print "using installed version:", wx.lib.floatcanvas.__version__
|
||||
print("using installed version: %s" % wx.lib.floatcanvas.__version__)
|
||||
elif ver == 'local':
|
||||
## import a local version
|
||||
import sys
|
||||
|
||||
@@ -122,12 +122,12 @@ class TestPanel(wx.Panel):
|
||||
|
||||
def OnPrevPageButton(self, event):
|
||||
for i in self.wv.GetBackwardHistory():
|
||||
print i.Url, i.Title
|
||||
print("%s %s" % (i.Url, i.Title))
|
||||
self.wv.GoBack()
|
||||
|
||||
def OnNextPageButton(self, event):
|
||||
for i in self.wv.GetForwardHistory():
|
||||
print i.URL, i.Title
|
||||
print("%s %s" % (i.Url, i.Title))
|
||||
self.wv.GoForward()
|
||||
|
||||
def OnCheckCanGoBack(self, event):
|
||||
|
||||
@@ -3,7 +3,7 @@ A simple sample of using a wx.Overlay to draw a rubberband effect
|
||||
"""
|
||||
|
||||
import wx
|
||||
print wx.version()
|
||||
print(wx.version())
|
||||
|
||||
class TestPanel(wx.Panel):
|
||||
def __init__(self, *args, **kw):
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import wx
|
||||
from wx.lib.six import print_
|
||||
import os
|
||||
|
||||
FONTSIZE = 10
|
||||
@@ -178,7 +179,7 @@ class PrintFrameworkSample(wx.Frame):
|
||||
data = dlg.GetPageSetupData()
|
||||
self.pdata = wx.PrintData(data.GetPrintData()) # force a copy
|
||||
self.pdata.SetPaperId(data.GetPaperId())
|
||||
#print "paperID %r, paperSize %r" % (self.pdata.GetPaperId(), self.pdata.GetPaperSize())
|
||||
#print_("paperID %r, paperSize %r" % (self.pdata.GetPaperId(), self.pdata.GetPaperSize()))
|
||||
self.margins = (data.GetMarginTopLeft(),
|
||||
data.GetMarginBottomRight())
|
||||
dlg.Destroy()
|
||||
@@ -224,20 +225,20 @@ class PrintFrameworkSample(wx.Frame):
|
||||
dlg = wx.PrintDialog(self, data)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
data = dlg.GetPrintDialogData()
|
||||
print
|
||||
print "GetFromPage:", data.GetFromPage()
|
||||
print "GetToPage:", data.GetToPage()
|
||||
print "GetMinPage:", data.GetMinPage()
|
||||
print "GetMaxPage:", data.GetMaxPage()
|
||||
print "GetNoCopies:", data.GetNoCopies()
|
||||
print "GetAllPages:", data.GetAllPages()
|
||||
print "GetSelection:", data.GetSelection()
|
||||
print "GetCollate:", data.GetCollate()
|
||||
print "GetPrintToFile:", data.GetPrintToFile()
|
||||
print_()
|
||||
print_("GetFromPage:", data.GetFromPage())
|
||||
print_("GetToPage:", data.GetToPage())
|
||||
print_("GetMinPage:", data.GetMinPage())
|
||||
print_("GetMaxPage:", data.GetMaxPage())
|
||||
print_("GetNoCopies:", data.GetNoCopies())
|
||||
print_("GetAllPages:", data.GetAllPages())
|
||||
print_("GetSelection:", data.GetSelection())
|
||||
print_("GetCollate:", data.GetCollate())
|
||||
print_("GetPrintToFile:", data.GetPrintToFile())
|
||||
|
||||
self.pdata = wx.PrintData(data.GetPrintData())
|
||||
print
|
||||
print "GetPrinterName:", self.pdata.GetPrinterName()
|
||||
print_()
|
||||
print_("GetPrinterName:", self.pdata.GetPrinterName())
|
||||
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
# independence, override defaults, ignore features, etc.
|
||||
|
||||
from math import sin, cos, pi
|
||||
from wx.lib.six import print_
|
||||
|
||||
# Rose class knows about:
|
||||
# > Generating points and vectors (returning data as a list of points)
|
||||
@@ -150,7 +151,7 @@ class rose:
|
||||
# update parameters or stop.
|
||||
def restart(self):
|
||||
if self.verbose:
|
||||
print 'restart: int_state', self.int_state, 'cmd_state', self.cmd_state
|
||||
print_('restart: int_state', self.int_state, 'cmd_state', self.cmd_state)
|
||||
try:
|
||||
tmp = self.sin_table[0]
|
||||
except:
|
||||
@@ -191,7 +192,7 @@ class rose:
|
||||
# before initialization is done.
|
||||
def repaint(self, delay):
|
||||
if self.int_state != self.INT_RESIZE:
|
||||
# print 'repaint after', delay
|
||||
# print_('repaint after', delay)
|
||||
self.int_state = self.INT_RESIZE
|
||||
self.AppCancelTimer()
|
||||
self.AppAfter(delay, self.clock)
|
||||
@@ -263,7 +264,7 @@ class rose:
|
||||
# roses is 0.)
|
||||
def clock(self):
|
||||
if self.int_state == self.INT_IDLE:
|
||||
# print 'clock called in idle state'
|
||||
# print_('clock called in idle state')
|
||||
delay = 0
|
||||
elif self.int_state == self.INT_DRAW:
|
||||
line, run = self.roselet()
|
||||
@@ -294,7 +295,7 @@ class rose:
|
||||
|
||||
if delay == 0:
|
||||
if self.verbose:
|
||||
print 'clock: going idle from state', self.int_state
|
||||
print_('clock: going idle from state', self.int_state)
|
||||
else:
|
||||
self.AppAfter(delay, self.clock)
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
import wx
|
||||
import clroses
|
||||
import wx.lib.colourselect as cs
|
||||
|
||||
from wx.lib.six import print_
|
||||
|
||||
# Class SpinPanel creates a control that includes both a StaticText widget
|
||||
# which holds the the name of a parameter and a SpinCtrl widget which
|
||||
@@ -109,7 +109,7 @@ class SpinPanel(wx.Panel):
|
||||
name = self.st.GetLabel()
|
||||
value = self.sc.GetValue()
|
||||
if verbose:
|
||||
print 'OnSpin', name, '=', value
|
||||
print_('OnSpin', name, '=', value)
|
||||
self.callback(name, value) # Call MyFrame.OnSpinback to call clroses
|
||||
|
||||
|
||||
@@ -372,10 +372,10 @@ class MyFrame(wx.Frame, clroses.rose):
|
||||
h = max(600, fh) # Change 600 to desired minimum size
|
||||
w = h + fw - rw
|
||||
if verbose:
|
||||
print 'rose panel size', (rw, rh)
|
||||
print 'side panel size', (sw, sh)
|
||||
print ' frame size', (fw, fh)
|
||||
print 'Want size', (w,h)
|
||||
print_('rose panel size', (rw, rh))
|
||||
print_('side panel size', (sw, sh))
|
||||
print_(' frame size', (fw, fh))
|
||||
print_('Want size', (w,h))
|
||||
self.SetSize((w, h))
|
||||
self.SupplyControlValues() # Ask clroses to tell us all the defaults
|
||||
self.Show()
|
||||
@@ -386,25 +386,25 @@ class MyFrame(wx.Frame, clroses.rose):
|
||||
# Go/Stop button
|
||||
def OnGoStop(self, event):
|
||||
if verbose:
|
||||
print 'OnGoStop'
|
||||
print_('OnGoStop')
|
||||
self.cmd_go_stop()
|
||||
|
||||
# Redraw/Redraw
|
||||
def OnRedraw(self, event):
|
||||
if verbose:
|
||||
print 'OnRedraw'
|
||||
print_('OnRedraw')
|
||||
self.cmd_redraw()
|
||||
|
||||
# Backward/Reverse
|
||||
def OnBackward(self, event):
|
||||
if verbose:
|
||||
print 'OnBackward'
|
||||
print_('OnBackward')
|
||||
self.cmd_backward()
|
||||
|
||||
# Forward/Skip
|
||||
def OnForward(self, event):
|
||||
if verbose:
|
||||
print 'OnForward'
|
||||
print_('OnForward')
|
||||
self.cmd_step()
|
||||
|
||||
|
||||
@@ -415,11 +415,11 @@ class MyFrame(wx.Frame, clroses.rose):
|
||||
|
||||
def AppClear(self):
|
||||
if verbose:
|
||||
print 'AppClear: clear screen'
|
||||
print_('AppClear: clear screen')
|
||||
self.rose_panel.Clear()
|
||||
|
||||
def AppCreateLine(self, line):
|
||||
# print 'AppCreateLine, len', len(line), 'next', self.nextpt
|
||||
# print('AppCreateLine, len', len(line), 'next', self.nextpt)
|
||||
self.rose_panel.DrawLines(line)
|
||||
|
||||
# Here when clroses has set a new style and/or petal value, update
|
||||
@@ -467,8 +467,8 @@ class MyFrame(wx.Frame, clroses.rose):
|
||||
# Method to provide a single callback after some amount of time.
|
||||
def AppAfter(self, msec, callback):
|
||||
if self.timer_callback:
|
||||
print 'AppAfter: timer_callback already set!',
|
||||
# print 'AppAfter:', callback
|
||||
print_('AppAfter: timer_callback already set!')
|
||||
# print_('AppAfter:', callback)
|
||||
self.timer_callback = callback
|
||||
self.timer.Start(msec, True)
|
||||
|
||||
@@ -476,18 +476,18 @@ class MyFrame(wx.Frame, clroses.rose):
|
||||
# interest in.
|
||||
def AppCancelTimer(self):
|
||||
self.timer.Stop()
|
||||
# print 'AppCancelTimer'
|
||||
# print_('AppCancelTimer')
|
||||
self.timer_callback = None
|
||||
|
||||
# When the timer happens, we come here and jump off to clroses internal code.
|
||||
def OnTimer(self, evt):
|
||||
callback = self.timer_callback
|
||||
self.timer_callback = None
|
||||
# print 'OnTimer,', callback
|
||||
# print_('OnTimer,', callback)
|
||||
if callback:
|
||||
callback() # Often calls AppAfter() and sets the callback
|
||||
else:
|
||||
print 'OnTimer: no callback!'
|
||||
print('OnTimer: no callback!')
|
||||
|
||||
|
||||
resize_delay = 300
|
||||
@@ -502,7 +502,7 @@ class MyFrame(wx.Frame, clroses.rose):
|
||||
# Called when data in spin boxes changes.
|
||||
def OnSpinback(self, name, value):
|
||||
if verbose:
|
||||
print 'OnSpinback', name, value
|
||||
print_('OnSpinback', name, value)
|
||||
if name == 'Style':
|
||||
self.SetStyle(value)
|
||||
elif name == 'Sincr':
|
||||
@@ -530,7 +530,7 @@ class MyFrame(wx.Frame, clroses.rose):
|
||||
elif name == 'Delay':
|
||||
self.SetWaitDelay(value)
|
||||
else:
|
||||
print 'OnSpinback: Don\'t recognize', name
|
||||
print_('OnSpinback: Don\'t recognize', name)
|
||||
|
||||
verbose = 0 # Need some command line options...
|
||||
spin_panels = {} # Hooks to get from rose to panel labels
|
||||
@@ -539,6 +539,6 @@ ctrl_buttons = {} # Button widgets for command (NE) panel
|
||||
app = wx.App(False)
|
||||
MyFrame()
|
||||
if verbose:
|
||||
print 'spin_panels', spin_panels.keys()
|
||||
print 'ctrl_buttons', ctrl_buttons.keys()
|
||||
print_('spin_panels', spin_panels.keys())
|
||||
print_('ctrl_buttons', ctrl_buttons.keys())
|
||||
app.MainLoop()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import wx
|
||||
print wx.version()
|
||||
print(wx.version())
|
||||
|
||||
class TestPanel(wx.PyPanel):
|
||||
def __init__(self, *args, **kw):
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
|
||||
import wx
|
||||
print wx.version()
|
||||
##import os; print 'PID:', os.getpid(); raw_input('Ready to start, press enter...')
|
||||
from wx.lib.six import print_
|
||||
|
||||
print_(wx.version())
|
||||
#import os; print_('PID:', os.getpid()); raw_input('Ready to start, press enter...')
|
||||
|
||||
|
||||
class MyFrame(wx.Frame):
|
||||
def __init__(self, *args, **kw):
|
||||
@@ -10,21 +13,21 @@ class MyFrame(wx.Frame):
|
||||
wx.CallAfter(self.after, 1, 2, 3)
|
||||
|
||||
def after(self, a, b, c):
|
||||
print 'Called via wx.CallAfter:', a, b, c
|
||||
print_('Called via wx.CallAfter:', a, b, c)
|
||||
|
||||
def onSize(self, evt):
|
||||
print repr(evt.Size)
|
||||
print_(repr(evt.Size))
|
||||
evt.Skip()
|
||||
|
||||
class MyApp(wx.App):
|
||||
def OnInit(self):
|
||||
print 'OnInit'
|
||||
print_('OnInit')
|
||||
frm = MyFrame(None, title="Hello with Events", size=(480,360))
|
||||
frm.Show()
|
||||
return True
|
||||
|
||||
def OnExit(self):
|
||||
print 'OnExit'
|
||||
print_('OnExit')
|
||||
return 0
|
||||
|
||||
app = MyApp()
|
||||
|
||||
@@ -9,7 +9,7 @@ import threading
|
||||
import time
|
||||
import random
|
||||
|
||||
print wx.version()
|
||||
print(wx.version())
|
||||
|
||||
|
||||
class ThreadedTask(threading.Thread):
|
||||
@@ -23,7 +23,7 @@ class ThreadedTask(threading.Thread):
|
||||
while not self.timeToDie:
|
||||
time.sleep(self.sleepTime)
|
||||
self.counter += 1
|
||||
print 'thread: %5s count: %d' % (self.name, self.counter)
|
||||
print('thread: %5s count: %d' % (self.name, self.counter))
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user