473,233 Members | 1,441 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,233 software developers and data experts.

radio button again!

Hi,
Am using Tkinter. Suppose I have 4 radio buttons (value 1,2,3 & 4) arranged in a single column. I want radio 2 to have a normal state and radio 4 to have a disabled state when radio 1 is selected. And radio 2 - disabled, radio 4 - normal when radio 3 is selected (i.e. vice versa). My main question here is how do i get to know the state(i.e. normal or disabled) of a radio button as a feedback? thanx in advance
Dec 5 '07 #1
2 1684
anybody??? nobody's got a solution?? the main difficulty i am facing is how to effectively use button.configure(state=NORMAL) or button.configure(state=DISABLED)... help will really be appreciated guys... thanks...
Dec 5 '07 #2
dazzler
75
Expand|Select|Wrap|Line Numbers
  1. master = Tk()
  2.  
  3. def radiobutton_command():
  4.    if radiobutton_var.get() == 1:
  5.       radiobutton_2["state"] = NORMAL
  6.       radiobutton_4["state"] = DISABLED
  7.  
  8.    if radiobutton_var.get() == 2:
  9.       pass
  10.  
  11.    if radiobutton_var.get() == 3:
  12.       radiobutton_2["state"] = DISABLED
  13.       radiobutton_4["state"] = NORMAL
  14.  
  15.    if radiobutton_var.get() == 4:
  16.       pass
  17.  
  18. radiobutton_var = IntVar()
  19.  
  20. radiobutton_1 = Radiobutton(master, text="Button 1", variable=radiobutton_var, value=1, command=radiobutton_command)
  21. radiobutton_1.place(x=0, y=0)
  22. radiobutton_2 = Radiobutton(master, text="Button 2", variable=radiobutton_var, value=2, command=radiobutton_command)
  23. radiobutton_2.place(x=0, y=0)
  24. radiobutton_3 = Radiobutton(master, text="Button 3", variable=radiobutton_var, value=3, command=radiobutton_command)
  25. radiobutton_3.place(x=0, y=0)
  26. radiobutton_4 = Radiobutton(master, text="Button 4", variable=radiobutton_var, value=4, command=radiobutton_command)
  27. radiobutton_4.place(x=0, y=0)
  28.  
  29. master.mainloop()
  30.  
ofcourse you must add more state changes for each radiobutton, for example if you press radiobutton1 and then button2, the state of button4 stays disabled...
Dec 7 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Rick | last post by:
After being frustrated with this issue on several occasions I think I found the secret sauce for solving the issue after reading a few different messages about what others thought and trying a...
3
by: ewitkop90 | last post by:
Here is my code: <SCRIPT> function transportchange(transport) { if (framenewinstall.Helpdesk.checked) framenewinstall.Helpdesk.checked=false; if (framenewinstall.CircuitNumber.checked)...
0
by: SenthilVel | last post by:
Hi i have radio buttons in my Page and i am able to see some starnge behaviour with those. 1st : DSN 2nd radio button: MSDE the above 2 are in collection.
2
by: SenthilVel | last post by:
Hi i have radio buttons in my Page and i am able to see some starnge behaviour with those. 1st : DSN 2nd radio button: MSDE the above 2 are in collection.
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
1
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio...
3
by: Harry Haller | last post by:
I have a radio button group. When the page loads none of them are selected. OnClick selects ONE and clicking another one selects a different one - this is normal behavior. I want to modify it so...
4
by: Z.K. | last post by:
I started a forms application and I put on the form three buttons. In the functions for the radio buttons I put in a single messagebox like: MessageBox("Hello 1") MessageBox("Hello 2") ...
11
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server...
1
by: avinash sh | last post by:
i have radio type html control....i select on radio button and click on select button it is redirected to next page...if i click on back button again i back on radio button page... then one of the...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.