I'm using tkinter for my application (written in Python).
Till now I've needed only "next" button so I didnt have a problem, but now I want to add a screen (after several "next") where I'm asking a yes/no question so I want to have 2 buttons for "yes" and "no" and that the next button will disapear, and after that it will be returned and the others will disapeared.
Is there a way to do that?
TNX
Use your_button.pack_forget() for that. If you are using another place manager just use place_forget or grid_forget method.
Related
I try all the night for my problem so now I just ask the question here.
It's seems simple : how to disable a spinbox with a radiobutton?
I try to create 2 functions disable and enable and use the command in the command radiobutton but it does nothing. I try also to use the "parents" thing and it's not working. I try to just use a if but like always : not working.
Here (Python tkinter Entry widget status switch via Radio buttons) I found some code who do what I want but with pack (I just change the entry by spinbox and it worked). However, it's a big program and I can't recode and relearn all with pack.
Anyone have an idea?
Thanks a lot ðŸ˜
How do I make a step-by-step GUI Layout with Tkinter Python 3.7? What I mean is that I want to have the user enter some information, press the "NEXT" button and enter some more information, etc. I don't think there's really a feasible way to completely change the layout like this with Tkinter, so I'm hoping there's something I'm missing. How do I do this?
I don't think there's really a feasible way to completely change the layout like this with Tkinter,
That is incorrect. This is trivially easy with Tkinter. Create a function or class for each step. All of the widgets for that step should be inside a single frame.
You then just need to call the first function or class to create the frame. When the user clicks "next", destroy the frame and create the next frame. And so on.
I am using a SearchCtrl with a dropdown menu and I'm having some trouble with the events. When I click the little arrow next to the search button, the EVT_SEARCHCTRL_SEARCH_BTN is triggered, which is not what I want. I only want the EVT_MENU_RANGE to be triggered after I clicked an item, and not also the EVT_SEARCHCTRL_SEARCH_BTN before i click it.
self.search_ctrl = wx.SearchCtrl(self.panel_1, -1,
style=wx.TE_PROCESS_ENTER)
self.search_menu = wx.Menu()
self.search_items = {"text1":"value1", "text2":"value2"}
for txt in self.search_items:
self.search_menu.Append(-1, txt)
self.search_ctrl.SetMenu(self.search_menu)
self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.search, self.search_ctrl)
self.Bind(wx.EVT_MENU_RANGE, self.onSearchMenu)
Although I should probably add id's to the menu bind, this isn't causing the problem. The code works as expected when I comment out the search button bind.
UPDATE
Apparently this isn't a problem, but a 'feature' of the searchctrl. I tried the wxpython demo and the menu also showed up if I just clicked the search button, and not the arrow. It is apparently one button, instead of the two i thought it was.
Is there a way to accomplish my original request? Do i have to manually modify a textctrl, or is there an other solution?
All the examples I've seen suggest you need to specify a range of IDs when you call your menu bind.
Maybe by default it binds to something unexpected... ?
Edit - In light of your update, it seems likely that you're going to need to make a custom control to me..
I can implement a trayicon with popup menu following the code of this topic:
Quick and easy: trayicon with python?
thanks for the guys in that topic very much and now I have another question here:
Could I add a textbox control in the menu to let the user to input something?
What I want is a menu with textbox control:
In the official doc and demo of wxPython we can see the text control added to the menubar, but not the popup menu.
Thanks
Did you try it? I can't think of any limitations on the PopupMenu that would prevent you from doing it. If it doesn't work, try using FlatMenu. That widget is pure Python and can probably be hacked to support it if it doesn't already.
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