How to allow only one checkbox checked at a time? - python

I am making a GUI for a script in Python, using PySide Qt. I have a couple of checkboxes in the main window and I was wondering if it is possible to make them dependant to each other. What I mean is that, if I check one of them, all the others should become unchecked. So only one can be checked at a time.
Is there a comfortable way to do this? Otherwise I would just write a function to uncheck the others.

use QButtonGroup to make them as a group and you might want to derive a class from this and override the basic check/uncheck depending on how you want the checkboxes to behave

Related

Opening up a Drop-Down-Menu Tkinter

I have been implementing in a drop down menu (offically called a "Tkinter.OptionMenu") inside my application, that once clicked open will allow users to skip to certain parts of the form (like skipping to a certain chapter of a book/play). I want to be able to OPEN that drop down menu on an event i.e with code however as much as i have searched, it seems the very best i can do i to do a .focus_set() which is better than nothing, but all it does it place a faint outline around the widget. I would like it to fully open it up, just as if the user had clicked on it.
I'm pretty sure that i'm missing something simple, but help would be appreciated :)
Edit: Yes, i do have good reason to programatically open it, and even if i didn't it would still be nice to find out. I do not need access to the functions the list gives, but rather, i need the user to pick something from that drop down, and so i would like to open it for them

Best practice for TextInput validation in kivy/kv

I'm designing a GUI for android with kivy. There are many TextInput-fields, most of them need some kind of validation. What I've found so far is, that on_text_validate would allow for plausibility checks, but only if the user leaves that field with ENTER, which is rarely the case in an android-environment. How can I achieve checks if the user sets the focus to another widget by tapping?
Doing this (allways) with on_text seems a bit weird to me, but maybe it's possible. A simple example: how would you make sure that the user is only able to insert integers and that the value is in a definite range?
The other question I would like to ask: how is it possible to deactivate a TextInput depending on the value of previous inputs or to set the focus appropriately?
I think these are standard tasks in GUI-programming and I'm a bit confused on how to manage these in kivy - help would be very appreciated!

How can a wxpython frame "steal" and "return" focus similar to the Dash app?

I want to make a heads-up display that pops up it's frame, taking focus from the previous application and then gives focus back to that application when it's done.
wxPython frames have Hide and Show methods that work but don't focus the application. Also, there's SetFocus which you'd think would do it but doesn't.
Update
I found a nasty hack that works. Rather than hide and show the frame, you save the app state and close the app instead of hiding. Then when you want to show again you spark a new one in a new multiprocessing.Process. Hardly ideal though. I hope someone has something better.
Clarification
To clarify, I'm trying to get the keyboard focus, not just to get the frame on top of the stack.
This issue might be specific to OS X.
You might be able to steal focus by calling Raise on the frame. There is the wx.STAY_ON_TOP style flag that could also be applied. Then you might be able to just use the frame's Show and Hide methods to make it work.
Depending on what exactly you want to do, you might take a look at the ToasterBox widget. I can't recall if it actually steals focus, but it just pop up and go away on its own, which is handy in some cases.

How to get multiple panels in one window - GTK+

I am looking to know what is the best practice to make a window which the content changes, but without changing the window. Something like using tabs, but with no tabs, controlled with buttons.
What widget should i use to archive what i need?
And if you don't mind the little off-topic, should it be drawn manually or with a GUI designer like glade?
It is meant to be used within python.
If you can use GTK 3.10, take a look at GtkStack and GtkStackSwitcher. If not, use GtkNotebook and set the show_tabs property to False, then build your own buttons.

wxPython: control navigation within wx.Lisbook wx.Panels

world!
I'd like to ask you one question, a simple solution (I guess) for a nerve-wracking problem I'm encountering using a wx.Lisbook component of wxPython.
In fact, I want to switch from a wx.Panel to another fluently, withou requiring a user input. I've already tried the SetFocus(), Show()/ShowWithEffect() + Hide()/HideWithEffect() methods, without great results.
Show()/Hide() gives the better results, but the selected Thumbnail remains the previous displayed panel...
Any idea of the method or good practice to manipulate wx.Listbook?
Thanks very much by advance for your answers!
Patrice
You want to be able to switch between panels? You should check out the various "Book" controls in wxPython, such as the Toolbook, Notebook, AUINotebook, etc. I also wrote a tutorial that's just on switching panels using the menu:
http://www.blog.pythonlibrary.org/2010/06/16/wxpython-how-to-switch-between-panels/
You could use a wx.Timer to do the switching too if you didn't want any user involvement.

Categories

Resources