|
From: hwg <hw...@ya...> - 2011-04-12 02:12:59
|
On Mac it seems the FontDialog does not work properly. When you try to open the
font dialog, it flashes on the screen for a split second (in the lower right
corner), then disappears.
The same code run in Windows works fine.
The code is pasted below. Any help would be appreciated.
-hwg
--------------------------------------
# fontDialog.py
from PythonCard import model, dialog
class MainWindow(model.Background):
def on_btnColor_mouseClick(self, event):
a = dialog.colorDialog(self).color
self.components.txtTyping.foregroundColor = a
event.target.backgroundColor = a
def on_btnFont_mouseClick(self, event):
a = dialog.fontDialog(self, event.target.font)
self.components.txtTyping.font = a.font
event.target.font = a.font
app = model.Application(MainWindow)
app.MainLoop()
#fontDialog.rsrc.py
{'application':{'type':'Application',
'name':'Template',
'backgrounds': [
{'type':'Background',
'name':'bgTemplate',
'title':u'Standard Template with File->Exit menu',
'size':(400, 300),
'menubar': {'type':'MenuBar',
'menus': [
{'type':'Menu',
'name':'menuFile',
'label':'&File',
'items': [
{'type':'MenuItem',
'name':'menuFileExit',
'label':'E&xit',
'command':'exit',
},
]
},
]
},
'components': [
{'type':'Button',
'name':'btnColor',
'position':(316, 10),
'label':u'Color...',
},
{'type':'Button',
'name':'btnFont',
'position':(10, 10),
'label':u'Font...',
},
{'type':'TextArea',
'name':'txtTyping',
'position':(10, 32),
'size':(381, 231),
},
] # end components
} # end background
] # end backgrounds
} } |