I am working on a project that is going to use tkinter. I was wondering if there was any way to display a different set of widgets based on a radio button selection and it update as soon as it is clicked
You could, for example, put your sets of widgets in different tkinter Frames and show/hide them on demand as you select different radio buttons.
Related
I have a sort of to-do list app and I would like to make it so that a user can click and drag down a list of checkboxes, toggling their state to be that of the first box clicked. Basically the same as this HTML question here: "Check" Multiple Checkboxes With Click & Drag?.
How would I go about doing this in Qt? I tried subclassing the mouseMoveEvent of a checkbox to get the current mouse state, but that did not work out for a number of reasons (not the least of which is that per the documenation mouseMoveEvents always return Qt.NoButton). I also ran into focus issues, whereby when the first box is clicked it grabs focus until the mouse is let go of, thus blocking signals to the other boxes.
I am using ListAdapter to create a list of buttons and also use them as multiselect.
I want something like button + multiselect that means; when I touch and hold a button for sometime, it should go for multi selection. On a single button click, it should work as a normal button.
Any idea how this is done in Kivy?
self.list_adapter = ListAdapter(data=[],selection_mode='multiple',
cls=ListItemButton, sorted_keys=[])
I am using Python 3 with gobject introspection for Gtk. How can I have more than one toggle button linked together so they behave similar to tabs or radiobuttons - e.g. one is selected by default, and when another is clicked the previously active one is de-selected.
I have tried using set_sensetive, but that greys out the widget that it is applied on.
Use a Gtk.RadioButton and set draw indocator mode to False
button1 = Gtk.RadioButton("Product Codes")
button1.set_mode(False)
https://lazka.github.io/pgi-docs/Gtk-3.0/classes/ToggleButton.html#Gtk.ToggleButton.set_mode
Thx to:
https://stackoverflow.com/a/15123955/1907997
and
How can I link a set of toggle buttons like radio buttons?
Use set_active() (or props.active). Alternatively, you can create some Gtk.RadioButton widgets and set draw_indicator property to False. In the latter case you can create radio groups in normal way, without custom handling.
You listen to the toggle signals on the toggle button then call set_active() on the other ones. You need to block the toggled signals while calling set_active()so that you don't get into a loop.
I have a wxPython app with three listboxes. I'd like to make it so something can only be selected in one of them at a time. I thought I could use an event when the listbox is clicked to deselect the other boxes, but there are no events listed for wx.ListBox at wxpython.org. Is there another way to do this?
I think what you want is EVT_LISTBOX
I am developing a GUI in Vizard in which i am using radio buttons to select correct options, but I have a problem that I cannot solve.
In every group of radio buttons the 1st button always appears to be selected, but is actually not selected. The only way to select it is by choosing another button and then choosing the 1st button again.
Does anyone know how to solve this? I would like that in the beginning none of the buttons are selected.
I don't know Vizard but radio buttons probably have a method or another way of deselecting them similar to radiobutton.deselect() method of Tkinter. Have you looked at their documentation?
Also someone have done this trick, may be you should try it:
Create another radio button in that group, let it be selected by default and make it invisible
QuestionBox = vizinfo.add("") #Add the vizinfo object
#Create an invisible Radio button to be the default selected one, so that one of the visible ones must be chosen by the user
invisibleRadio = QuestionBox.add(viz.RADIO, 0, "")
invisibleRadio.visible(0) #invisible
source: http://forum.worldviz.com/showthread.php?t=1611