Skip to content

Commit 3ff843e

Browse files
author
Metallicow
committed
Fix Shebang/Cleanup/Readability
1 parent 5ed780c commit 3ff843e

File tree

1 file changed

+17
-37
lines changed

1 file changed

+17
-37
lines changed

DrawLinesTest.py

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#!/usr/bin/env python2.4
1+
#!/usr/bin/env python
22

33
import wx
44
import numarray
55
from numarray import random_array
6-
import RandomArray # the Numeric version
6+
import RandomArray # the Numeric version.
77
import time
88

99

@@ -12,31 +12,30 @@
1212

1313
## Make some random data to draw things with.
1414
MaxX = 500
15-
LinesPoints = random_array.randint(1, MaxX, (NumLinePoints,2) )
16-
#PointsPoints = random_array.randint(1, MaxX, (NumPointPoints,2) )
17-
PointsPoints = RandomArray.randint(1, MaxX, (NumPointPoints,2) ) # Numeric
18-
15+
LinesPoints = random_array.randint(1, MaxX, (NumLinePoints, 2))
16+
#PointsPoints = random_array.randint(1, MaxX, (NumPointPoints, 2))
17+
PointsPoints = RandomArray.randint(1, MaxX, (NumPointPoints, 2)) # Numeric.
1918

2019

2120
class TestFrame(wx.Frame):
2221
def __init__(self):
2322
wx.Frame.__init__(self, None, -1, "DrawLines Test",
24-
wx.DefaultPosition,
25-
size=(500,500),
26-
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
23+
wx.DefaultPosition,
24+
size=(500,500),
25+
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
2726

28-
## Set up the MenuBar
27+
# Set up the MenuBar.
2928
MenuBar = wx.MenuBar()
30-
29+
3130
file_menu = wx.Menu()
3231
ID_EXIT_MENU = wx.NewId()
33-
file_menu.Append(ID_EXIT_MENU, "E&xit","Terminate the program")
32+
file_menu.Append(ID_EXIT_MENU, "E&xit", "Terminate the program")
3433
wx.EVT_MENU(self, ID_EXIT_MENU, self.OnQuit)
3534
MenuBar.Append(file_menu, "&File")
36-
35+
3736
draw_menu = wx.Menu()
3837
ID_DRAW_MENU = wx.NewId()
39-
draw_menu.Append(ID_DRAW_MENU, "&ReDraw","DrawAgain")
38+
draw_menu.Append(ID_DRAW_MENU, "&ReDraw", "DrawAgain")
4039
wx.EVT_MENU(self, ID_DRAW_MENU,self.ReDraw)
4140
MenuBar.Append(draw_menu, "&Draw")
4241

@@ -46,14 +45,14 @@ def __init__(self):
4645

4746
def OnPaint(self,event):
4847
dc = wx.PaintDC(self)
49-
dc.SetBackground( wx.Brush("White") )
48+
dc.SetBackground(wx.Brush("White"))
5049
dc.Clear()
5150
self.DrawLines(dc)
5251
self.DrawPoints(dc)
5352

5453
def ReDraw(self, event = None):
5554
dc = wx.ClientDC(self)
56-
dc.SetBackground( wx.Brush("White") )
55+
dc.SetBackground(wx.Brush("White"))
5756
dc.Clear()
5857
self.DrawLines(dc)
5958
self.DrawPoints(dc)
@@ -64,15 +63,15 @@ def DrawLines(self, dc):
6463
start = time.clock()
6564
#dc.DrawLines(LinesPoints.tolist())
6665
dc.DrawLines(LinesPoints)
67-
print "DrawLines Call took %f seconds"%(time.clock() - start)
66+
print("DrawLines Call took %f seconds" %(time.clock() - start))
6867
dc.EndDrawing()
6968

7069
def DrawPoints(self, dc):
7170
dc.BeginDrawing()
7271
dc.SetPen(wx.Pen('Red', 2))
7372
start = time.clock()
7473
dc.DrawPointList(PointsPoints)
75-
print "DrawPointList Call took %f seconds"%(time.clock() - start)
74+
print("DrawPointList Call took %f seconds" %(time.clock() - start))
7675
dc.EndDrawing()
7776

7877
def OnQuit(self,event):
@@ -89,22 +88,3 @@ def OnInit(self):
8988
if __name__ == "__main__":
9089
app = DemoApp(0)
9190
app.MainLoop()
92-
93-
94-
95-
96-
97-
98-
99-
100-
101-
102-
103-
104-
105-
106-
107-
108-
109-
110-

0 commit comments

Comments
 (0)