473,409 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

wx.Font.GetPointSize returning bogus value?

The following program gets a TextCtrl's text attributes and sets them
back unchanged. However it reports that the font size is 124, and after
resetting the attributes the text becomes that size. That is, the
window displays a normal-size "foo" and a gigantic "bar". Anyone know
what's going on?

This is WxPython 2.6 on Python 2.5 on Windows XP.

----------------------------------

import sys
import wx

class MyApp (wx.App):

def __init__ (self):
wx.App.__init__(self, redirect=0)

def OnInit (self):
top = wx.Frame(None, size=(500, 300))
txt = wx.TextCtrl(top, -1, "foo\n", (-1, -1), (400, 200),
wx.TE_RICH|wx.TE_READONLY|wx.TE_MULTILINE)
top.Show()

attrs = wx.TextAttr()
txt.GetStyle(0, attrs)
font = attrs.GetFont()
print "font face", font.GetFaceName() # prints MS Shell Dlg 2
print "font family", font.GetFamily() # prints 74
print "font size", font.GetPointSize() # prints 124!
txt.SetDefaultStyle(attrs)
txt.AppendText("bar\n")
return True

app = MyApp()
app.MainLoop()

Dec 9 '06 #1
1 1588
"Roger Miller" <ro**********@nova-sol.comwrote:
>
The following program gets a TextCtrl's text attributes and sets them
back unchanged. However it reports that the font size is 124, and after
resetting the attributes the text becomes that size. That is, the
window displays a normal-size "foo" and a gigantic "bar". Anyone know
what's going on?
....
print "font face", font.GetFaceName() # prints MS Shell Dlg 2
print "font family", font.GetFamily() # prints 74
print "font size", font.GetPointSize() # prints 124!
Not sure. On my system, the console output is the same, but the "bar"
appears as a solid black box of the right size (that is, 124 points).

It is a strange set of results. "MS Shell Dlg 2" is a fake font name that
remaps to a real font depending on your operating system and locale. 74
(0x4A) indicates a vector TrueType font of the "script" family, which is
bizarre.

May I suggest that you set your own default font before beginning?
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Dec 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Csaba2000 | last post by:
How do I detect when the font size has been changed (especially by user action: either Ctrl+Scroll wheel or View/Text Size)? This is just for use on IE 5.5+, but it would be great if there was a...
39
by: David Jubinville | last post by:
Hi All, I've run into a bit of an interesting problem with CSS and font DPI and would certainly welcome help. Problem: Page layout defined in CSS has font size issues (overlapping frames,...
1
by: shachar | last post by:
hi all. i have a grid ocx i'm using, and i have to set it's font to an integer value returning from a font object. when i wrote : Dim f As System.Drawing.Font al it's propertys are readonly. how...
13
by: al jones | last post by:
I think I need to degrade this to make it work so I'll ask a really basic question. I'm trying to display a set of fonts that are *not* installed but are present on my computer. Is there any...
60
by: deko | last post by:
As I understand it, most browser manufacturers have agreed on 16px for their default font size. So, this should be an accurate conversion for percentages: px % 16 = 100 14 = 87.5 13 =...
71
by: Mark | last post by:
Sorry if the question is a bit basic. I generally express my font sizes in pixels, originally to handle the Macintosh/Windows font size differences (though I believe that they both now treat...
43
by: Andy Mabbett | last post by:
I'm about to publish (what's the web equivalent of "reprint"?) an old paper article, whose heading is in this font: <http://www.flickr.com/photos/pigsonthewing/2446437162/> Can anyone kindly...
14
by: Roedy Green | last post by:
Is there a shortcut way to define the default font family (and characteristics) to be applied to all styles? -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
0
by: babai28 | last post by:
Hi there! I have a rich text box and in the formatting toolbar (that sticks to its upper border) I have a ComboBox that displays the standard Font sizes. Just like it is in MS Word or Excel. The...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.