From: Steve H. <sh...@ho...> - 2003-10-07 12:36:41
|
I'm wondering if the best solution might not be to inherit a default font from a panel (which in turn could inherit the system font if no explicit font were set)? We certainly want the default behavior to work on all platforms. How much difference will this make to resource file size, and is that really a concern? I've always assumed that the .rsrc.py files are for computer use only, and on modern computers the difference between a 100-line and a 300-line Python file probably isn't all that large ... regards -- Steve Holden +1 703 278 8281 http://www.holdenweb.com/ Improve the Internet http://vancouver-webpages.com/CacheNow/ Python Web Programming http://pydish.holdenweb.com/pwp/ Interview with GvR August 14, 2003 http://www.onlamp.com/python/ > -----Original Message----- > From: pyt...@li... > [mailto:pyt...@li...]On > Behalf Of Kevin > Altis > Sent: Tuesday, October 07, 2003 4:02 AM > To: chr...@ph...; Andy Todd > Cc: pyt...@li... > Subject: RE: [Pythoncard-users] resourceEditor and TextFields > > > Okay I see what the problem is now, but I'm still not sure > what the best > solution is. The fundamental problem is that when a control > is created in > wxWindows the default system font is used as the basis for > interpreting the > size parameters. If the height is -1 then you'll get a height > that makes > sense for that font, not Times New Roman Bold 12 point. > > If you look at PythonCardPrototype/widget.py you'll see that during > _postInit, PythonCard sets the font if needed. You'll also > see that the code > used to call _setSize after setting the font which would > probably fix your > problem. > > if aResource.font is None: > self._font = None > else: > self._setFont(font.Font(aResource.font, self)) > # KEA 2002-02-12 > # these should be handled by __init__ so I don't see any > # reason to set them again > #self._setPosition( aResource.position ) > #self._setSize( aResource.size ) > > In the short term, you can either uncomment self._setSize( > aResource.size ) > or manually set the size during your openBackground handler. > Sizers can also > solve the problem, but I think you may have to force a layout > refresh after > the font is changed. > > Most of the time, the resourceEditor code goes to great > lengths to avoid > writing default attributes out to the .rsrc.py files. If you look at > resourceOutput.py you'll see where it calls GetBestSize() to determine > whether it should save something other than -1 for the width > and height. > > If you need to experiment, just run the resourceEditor with > the Shell and > inspect the components manually. > > ka > > -----Original Message----- > From: chr...@ph... > Sent: Tuesday, October 07, 2003 12:01 AM > To: Andy Todd > Cc: pyt...@li... > Subject: Re: [Pythoncard-users] resourceEditor and TextFields > > > Dear Andy and others, > > I use the Times New Roman font with 12 pt and bold and try to make > TextFields of size (78,28). The resourceEditor automagically > turns this into > (-1,-1) for some reason (I haven't dug through the source code of the > resourceEditor, this code is a tad too > difficult for me to grasp) and with size (-1,-1) the > TextField is not high > enouygh for the text to fit in. Maybe the CVS code is changed > with respect > to version 0.7.1 but I was unable to tunnel CVS through our > firewall yet. > I'll have a look at it at home. > > Small note I create my GUI's in windows2000 and run them > there as well. I'll > have a look how it looks in (RedHat) Linux..... Thing look > better there with > respect to the (-1,-1) thing, but the GUI looks ugly anyway > because of these > font problems (fonts in > windows and linux are difficult to match). Maybe it is windows(2000) > related? > > with best regards, > > Christiaan > > -- > Dr. C. Kok (WY-41) > Philips Research Eindhoven > Prof. Holstlaan 4 > 5656 AA Eindhoven > The Netherlands > > > > > To: Christiaan > Kok/EHV/RESEARCH/PHILIPS@EMEA3 > cc: > pyt...@li... > Subject: Re: > [Pythoncard-users] resourceEditor and TextFields > > Andy Todd Classification: > <an...@ha...> > > 06-10-2003 22:55 > > > > > > > chr...@ph... wrote: > > Dear people, > > > > I found something in the resourceEditor concerning the size > of a TextField > which I am not sure if it is a bug or a feature. If you make > a textfield > bigger then the apparent height or width of the font used the > resourceEditor > automatically changes the > > width and height to -1, but the result is not always good. > For the font I > use (Times New Romand, bold, 12pt) the textfields become too small (in > Windows2000). This is rather weird because the automatic size > calculations > work perfect for things like > > buttons for instance. I now fix the size by editing the > resource files by > hand but that is not what you want of course. I am working with > PythonCardPrototype 0.7.1. > > > > with best regards, > > > > Christiaan Kok > > > > Seems to work ok for me on my Debian box with the latest CVS > code. If I > resize a textField the size attribute gets set appropriately, and if I > manually set it to (-1, -1) either in the resource editor or > directly in > the resource file the sizing is correct. I've experimented with > different fonts and can't re-create your problem. Does anyone > else see it? > > Does the same problem manifest itself in raw wxPython? If > you're stuck I > can probably come up with a nice simple application to test it out. > > Regards, > Andy > -- > -------------------------------------------------------------- > -------------- > ---- > From the desk of Andrew J Todd esq - http://www.halfcooked.com/ > > > > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Pythoncard-users mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/pythoncard-users > > |