@@ -15,44 +15,47 @@ def __init__(self, *args, **kwargs):
15
15
def OnPaint (self , event ):
16
16
dc = wx .PaintDC (self )
17
17
self .Draw (dc )
18
-
18
+
19
19
def Draw (self , dc ):
20
20
dc .Clear ()
21
21
x ,y = 20 , 0
22
- for fs in [8 , 10 , 12 , 14 , 18 , 20 , 30 , 60 ]:
23
- y += 1.2 * fs
22
+ for fs in [8 , 10 , 12 , 14 , 18 , 20 , 30 , 60 , 72 ]:
23
+ y += 1.2 * fs
24
24
w = fs * 11
25
- S = (0.45 * fs , fs ) # this hieght/width ratio seems to match what I get on OS-X and GTK
26
- text = "%i pixel Font and Box" % fs
27
- Font = wx .FontFromPixelSize (S , wx .SWISS , wx .NORMAL , wx .NORMAL , underlined = True )
25
+ S = (0.45 * fs , fs ) # this hieght/width ratio seems to match what I get on OS-X and GTK.
26
+ text = "%i pixel Font and Box" % fs
27
+ Font = wx .FontFromPixelSize (S , wx .FONTFAMILY_SWISS ,
28
+ wx .FONTSTYLE_NORMAL ,
29
+ wx .FONTWEIGHT_NORMAL ,
30
+ underlined = True )
28
31
dc .SetFont (Font )
29
32
E = dc .GetTextExtent (text )
30
33
dc .SetFont (Font )
31
34
E = dc .GetTextExtent (text )
32
- print "Font size: %s, Extent ratio: %s" % (S , E [0 ] / E [1 ])
33
- print "font point size::" , Font .GetPointSize ()
35
+ print ( "Font size: %s, Extent ratio: %s" % (S , E [0 ] / E [1 ]) )
36
+ print ( "font point size::" , Font .GetPointSize () )
34
37
dc .DrawText (text , x , y )
35
38
dc .DrawRectangle (x , y , w , fs )
36
39
dc .DrawText (text , x , y )
37
40
38
41
class MyFrame (wx .Frame ):
39
42
def __init__ (self , parent ):
40
- wx .Frame .__init__ (self , parent , title = "test" , size = (500 , 500 ))
43
+ wx .Frame .__init__ (self , parent , title = "test" , size = (500 , 500 ))
41
44
42
45
self .Panel = MyPanel (self )
43
46
44
47
sizer = wx .BoxSizer (wx .VERTICAL )
45
- sizer .Add (self .Panel ,1 , wx .EXPAND )
48
+ sizer .Add (self .Panel , 1 , wx .EXPAND )
46
49
47
50
self .SetSizer (sizer )
48
-
51
+
49
52
def UpdatePanel (self ,event ):
50
53
#self.Panel.DrawRect()
51
54
pass
52
-
55
+
53
56
if __name__ == '__main__' :
54
57
app = wx .App (0 )
55
58
frame = MyFrame (None )
56
59
frame .Show ()
57
60
app .MainLoop ()
58
-
61
+
0 commit comments