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

H

Hugh

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
 
G

greg

Hugh said:
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.
 
H

Hugh

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...
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top