From: richard k b. <ri...@co...> - 2005-09-01 23:56:18
|
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). #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 |
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 |
From: richard k b. <ri...@co...> - 2005-09-02 05:21:56
Attachments:
bobNotes.py
bobNotes.rsrc.py
|
thanks for your quick reply kevin! On 9/1/05 8:41 PM, Kevin Altis wrote: > > 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. hmm, cuz samples\flatfileDatabase.py is what i used as my starting point, too!? anyway, my "bobNotes" application and resource files atttached. > Also, just to make sure this isn't a > problem with an older version, are you using version 0.8.1 of > PythonCard? correct, i'm also using 0.8.1. > 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. i see only one on_editNewCard_command being bound: > DEBUG: : Thu Sep 1 16:20:30 2005: imported component statictext > DEBUG: : Thu Sep 1 16:20:30 2005: imported component staticbox > DEBUG: : Thu Sep 1 16:20:30 2005: imported component textfield > DEBUG: : Thu Sep 1 16:20:30 2005: imported component textarea > DEBUG: : Thu Sep 1 16:20:30 2005: imported component button > DEBUG: : Thu Sep 1 16:20:30 2005: imported component imagebutton > DEBUG: : Thu Sep 1 16:20:30 2005: Initializing Background... > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_close > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_editClear_command > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_editCopy_command > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_editCut_command > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_editDeleteCard_command > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_editNewCard_command > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_editPaste_command > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_editRedo_command ... > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_minimize > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_save_command > DEBUG: : Thu Sep 1 16:20:30 2005: _addHandler: on_sort_command > INFO: : Thu Sep 1 16:20:32 2005: filename: userdata.txt > INFO: : Thu Sep 1 16:20:32 2005: startup took 0.034445 seconds and btw, i get this from enabling logging via the samples/sample.py shell; while i can run my app from command line (pythonw bobNotes.py), i guess i don't know how to pass the -l option in this way? > 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. ok, but the gifs seem ok to me?! > 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. i've now looked again for examples in samples, and do find some that i'll hope to apply. thanks again! rik |
From: Kevin A. <al...@se...> - 2005-09-02 17:51:48
|
On Sep 1, 2005, at 10:20 PM, richard k belew wrote: > and btw, i get this from enabling logging via the samples/sample.py > shell; while i can run my app from command line (pythonw bobNotes.py), > i guess i don't know how to pass the -l option in this way? You'll want to use python (python.exe) instead of pythonw (pythonw.exe) if you want to get stdout console output. ka |