From: Kevin A. <al...@se...> - 2005-09-02 03:41:44
|
On Sep 1, 2005, at 4:55 PM, richard k belew wrote: > i'm a pythonCard newby, and these questions are probably way stupid. > but answers to either would help me considerably: > > #1: i've trying to make a minor, test change to the flatfileDatabase > sample. i thought i would decorate each card with a bit > of static text that shows its creation timestamp. > > so i added a new component in the .rsrc.py file: > >> {'type':'StaticText', 'name':'enterDate', 'position':(427, >> 19), 'text':'yymmdd', }, > > using resourceEditor i see that the command associated > with the "New Card" button is "editNewCard" and so i > then added a handler to my class: > >> def on_editNewCard_command(self, event): >> print "editNew" >> self.components.enterDate.text = >> datetime.datetime.now().strftime('%y/%m/%d %H:%M') >> flatfileDatabase.FlatfileDatabase.on_editNewCard_command(self, >> event) > > but nothing happens?! whether i click on the NewCard > button, or use the Menu's "New Card" option (which > MenuEditor shows me emits the same command), i DO > get a new card, but i do NOT > get the enterDate static string to be anything other > than its default "yymmdd". i also do NOT see the "editNew" > debugging message printed (whether i have full logging > and debugging on or not). I just tried adding an on_editNewCard_command event handler in samples\flatfileDatabase.py and the command did work just fine. Perhaps you have a typo in the actual source file. If you want to reply with an attachment we can take a look. Also, just to make sure this isn't a problem with an older version, are you using version 0.8.1 of PythonCard? If you run your application with the -l (L) command line option you should see each handler being bound, so if there is a typo you would see the original on_editNewCard_command bound as well as the command with the typo. BTW, running this sample I see that wx has developed a problem with the transparent next.gif and prev.gif images so I'll have to report that bug with wxPython 2.6.1.0. > #2: i'd like to make use of dialogs described at: > pythoncard.sourceforge.net/dialogs/ > using the codeEditor's scriptlets seems helpful, > but can you point me to JUST WHERE these bits should > be dropped, into an application like flatfile, addressbook...? > > thanks for any help. > > rik The dialogs can go in any event handler, you can even try them out in the shell since they are all single line function calls. Your event handler will lose control to the dialog until the dialog is dismissed. You can see numerous examples of using the various dialogs in the PythonCard samples and tools. ka |