main logo
Subject: [dabo-dev] Bug in Mac font handling
Author: Ed Leafe
Posted: 2008/05/30 09:27:36
 
View Entire Thread
New Search


I have code that changes the ForeColor of a label dynamically, and I
noticed that after a couple of such changes, the label was much
smaller. I traced it down to the macFontScaling code in dFont. I
understand the intention of the code, but there is something wrong in
the implementation, and I'm not sure where it is.

I've included code for a test case. Run it on a Mac, and click on the
blank area of the form. You'll notice that the label not only changes
color as expected, but steadily shrinks.

-- Ed Leafe


#!/usr/bin/env python
# -*- coding: utf-8 -*-
import dabo
dabo.ui.loadUI("wx")

class TestForm(dabo.ui.dForm):
def afterInit(self):
self.lbl = dabo.ui.dLabel(self, Caption="Testing", FontSize=24)
print "START", self.lbl.FontSize

def onMouseLeftDown(self, evt):
color = dabo.dColors.randomColor()
self.lbl.ForeColor = color
print dabo.dColors.tupleToHex(color), self.lbl.FontSize

if __name__ == "__main__":
app = dabo.dApp()
app.MainFormClass = TestForm
app.start()




 
©2008 Ed Leafe
<-- Prior Message New Search Next Message -->