[pygtk] not enough arguments?
Christopher Spears
cspears2002 at yahoo.com
Sun Aug 6 00:14:24 WST 2006
Thanks! I'll take a look at my code again next week.
Can I post my GUI to the forum as an attachment? Or
are attachments frowned upon?
-Chris
--- "Felix Rabe (public)"
<public at felixrabe.textdriven.com> wrote:
> Christopher Spears wrote:
> > Okay, I got the get_path function to print.
> >
> > Is there way to get return values? I was hoping
> to be
> > able to write get_path and get_pattern functions
> and
> > then use these functions inside the glob_files
> > function.
>
> You use get_path as a callback, which by definition
> is just a way for
> you to react to something. The caller of your
> callback function (i.e.,
> the GTK machinery) is not interested in your return
> value (unless it is
> called in response to an event, such as
> delete-event).
>
> You need to call the processing functions from the
> callback and then
> either write the result using print or to something
> like a TextView:
>
> def __init__(self):
> ...
> self.pattern_entry =
> self.wTree.get_widget("pattern_entry")
> self.textview = self.wTree.get_widget("textview1")
> # you better connect to "on_path_entry_activate" as
> well
> dic = { ... "on_pattern_entry_activate":
> self.cb_pattern_activate ... }
> ...
>
> def cb_pattern_activate(self, entry):
> matched_files =
> glob.glob(self.pattern_entry.get_text())
> buf = self.textview.get_buffer()
> buf.set_text("\n".join(matched_files))
>
> There are many questions remaining about your code
> that make responding
> in a way that solves your problem difficult:
>
> You use Glade, what does your GUI look like?
> Where do glob_files and print_dict get called from?
> Where do you assign a value to the "pattern"
> variable that is used in
> create_dict?
> ... and so on
>
> I hope you can use my few lines of code, though.
> Browse the
> documentation and tutorial on www.pygtk.org deeply
> to find out more, it
> is complete. If questions are remaining, just ask.
>
> Greetings,
> Felix
>
"I'm the last person to pretend that I'm a radio. I'd rather go out and be a color television set."
-David Bowie
"Who dares wins"
-British military motto
"I generally know what I'm doing."
-Buster Keaton
More information about the pygtk
mailing list