469,658 Members | 1,778 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,658 developers. It's quick & easy.

PyGUI - Couple of questions - TextField callbacks and drop downlist....

The PyGUI website specified this place as the place for general
discussion about it, so here goes....

First off - thanks for something that is so straightforward to get
running on OSX... I've been migrating some relatively straight-forward
scripts-with-GUIs from Linux to OSX, and, while I used FLTK on Linux,
I could not get pyfltk to install on OSX. PyGUI was so
straightforward, though. Made me a very happy bunny.

Fortunately, I wrote most of the pyfltk-specific code in a helper
module, so I got that transferred over to PyGUI easily enough. But
there were a few things that I ran up against....

So... A couple of questions for you all...

TextField callbacks... I want to be able to generate a callback when a
textfield is modified. The text field has to only allow a very
specific format in it, and in fltk, I'd just have the callback be a
validation function which would either reset it to the old value or
allow the current one. It doesn't appear to have an "action" member...
Is there anything I can do here? Or should I maybe subclass the
TextField class.....

Drop-down lists... There's a menu, but, apparently, no drop-down list
class. For now, I've replaced it with a RadioGroup, which is okay, for
now, as I know that there aren't going to be any more than 3 items,
but I can see situations where I'd really rather have a drop-down list
a part of the GUI, rather than in the menu at the top of the screen.

Anyway, any advice on this would be much appreciated! For the kind of
thing that I'm doing, it's very appreciated that there's something
that's very straightforward to install.
Hugh Macdonald
Oct 20 '08 #1
2 1592
Hugh wrote:
TextField callbacks... I want to be able to generate a callback when a
textfield is modified. It doesn't appear to have an "action" member...
I haven't got around to adding any actions to text fields
yet.

In the meantime, you could put a key_down method on the
containing window that catches the Return or Enter key.
Is there anything I can do here? Or should I maybe subclass the
TextField class.....
Unfortunately that's not easy to do at the moment. Due to
disparities in the way events are handled by the underlying
toolkits, PyGUI doesn't promise to let you intercept events
on the built-in control types by overriding methods.

I really need to rethink the whole event handling stragegy,
as it's rather a mess at the moment.
Drop-down lists...
That's another thing for the future. If you're feeling
adventurous, you could have a go at rolling your own based
on a View.

Anyway, glad you're finding it useful. Feel free to ask if
you have any more questions.

--
Greg
Oct 21 '08 #2
On Oct 21, 2:46*am, greg <g...@cosc.canterbury.ac.nzwrote:
Hugh wrote:
TextField callbacks... I want to be able to generate a callback when a
textfield is modified. It doesn't appear to have an "action" member...

I haven't got around to adding any actions to text fields
yet.

In the meantime, you could put a key_down method on the
containing window that catches the Return or Enter key.
Thanks - I think, for now, I'll probably just go with popping up an
Alert when the main window's "Launch" button is pressed... I'm a
little time-constrained on this project, but I'll maybe look into
getting it working more like I'm after at a later date...
Drop-down lists...

That's another thing for the future. If you're feeling
adventurous, you could have a go at rolling your own based
on a View.
Again, time constraints mean that I'll probably stick with the radio
buttons that I've got at the moment - they work quite well in this
situation - my query here was more of a general thing.
Anyway, glad you're finding it useful. Feel free to ask if
you have any more questions.
Thanks. Will definitely do this. It didn't take me very long at all to
transition over this GUI from pyfltk to PyGUI, which is definitely a
good sign...!
Hugh
Oct 21 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

108 posts views Thread by Zooko O'Whielacronx | last post: by
reply views Thread by Marc Christiansen | last post: by
2 posts views Thread by Tom Gao | last post: by
7 posts views Thread by Markus McGee | last post: by
4 posts views Thread by Rudy | last post: by
3 posts views Thread by greg | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.