Note that there are some explanatory texts on larger screens.

plurals
  1. POHow do I make radiobuttons assign either a 0,1,2 or 3 to my variables?
    primarykey
    data
    text
    <p><strong>Here is a rough example of a multiple choice test that I made. It runs in terminal and I'm hoping to make a Graphical User Interface for it using Tkinter.</strong></p> <pre><code>print "CATEGORY 1: ANXIOUS FEELINGS" print print "1. Anxiety, nervousness, worry or fear" BAI_var1 = input ("Please enter 0 for not at all, 1 for somewhat, 2 for moderatly or 3 for a lot:") print print "2. Feeling that things around you are strange, unreal, or foggy" BAI_var2 = input ("Please enter 0 for not at all, 1 for somewhat, 2 for moderatly or 3 for a lot:") print print "3. Feeling detached from all or part of your body" BAI_var3 = input ("Please enter 0 for not at all, 1 for somewhat, 2 for moderatly or 3 for a lot:") print "Depression Test" print print print "1. Sadness: Have been feeling sad or down in the dumps?" BDC_var1 = input ("Please enter 0 for not at all, 1 for somewhat, 2 for moderatly or 3 for a lot:") print print "2. Discouragement: Does the future look hopeless?" BDC_var2 = input ("Please enter 0 for not at all, 1 for somewhat, 2 for moderatly or 3 for a lot:") print print "3. Low self-esteem: Do you feel worthless or think of yourself as a failure?" BDC_var3 = input ("Please enter 0 for not at all, 1 for somewhat, 2 for moderatly or 3 for a lot:") #Burns Anxiety Inventory #CATEGORY 1: ANXIOUS FEELINGS Cat1_var = BAI_var1 + BAI_var2 + BAI_var3 #Burns Anxiety Checklist BAI_var = Cat1_var #Burns Depression Checklist BDC_var = BDC_var1 + BDC_var2 + BDC_var3 #Prints your BAI &amp; your BDC print "Your BAI =", BAI_var,"Your BDC =", BDC_var name = raw_input ("Please type in your name:") bai = str(input("Please enter your BAI:")) bdc = str(input("Please enter your BDC:")) year = str(input("please enter the year:")) month = str(input("Please enter the month:")) day = str(input("Please enter day:")) time_hour = str(input("Please enter the current hour:")) time_minute = str(input("Please enter the current minutes:")) am_pm = raw_input ("Please enter pm or am:") file = open('Burns inventory 1.3.txt', 'a') file.write(name + '\n') file.write(day) file.write("/") file.write(month) file.write("/") file.write(year) file.write('\n') file.write('\n') file.write('Your BAI is:') file.write(bai) file.write('\n') file.write('Your BDC is:') file.write(bdc) file.write('\n') file.write(time_hour) file.write(':') file.write(time_minute) file.write('\n') file.write(' ') file.write(am_pm) file.write('\n') file.close() </code></pre> <p><strong>I have been working for 2 days two teach myself how to use Tkinter. My friend and I made this rough example of what the test might look like.</strong></p> <pre><code>from Tkinter import * import time class App: def __init__(self, master): w = Label(master, text="1. Anxiety, nervousness, worry or fear") w.pack() v = IntVar() Radiobutton(master, text="0 for not at all", variable=v, value=1).pack(side=TOP, anchor="w") Radiobutton(master, text="1 for somewhat", variable=v, value=2).pack(side=TOP, anchor="w") Radiobutton(master, text="2 for moderatly", variable=v, value=3).pack(side=TOP, anchor="w") Radiobutton(master, text="3 for a lot", variable=v, value=4).pack(side=TOP, anchor="w") self.button = Button(master, text="BACK", fg="red", command=self.button6) self.button.pack(side=BOTTOM) self.button = Button(master, text="NEXT", fg="red", command=self.button5) self.button.pack(side=BOTTOM) def button6(self): print "Sam is awesome!GAJONGA" def button5(self): print "PYTHON FOR THE WIN! GIAN SAYS PYTHON = FILTHY" master = Tk() app = App(master) master.mainloop() </code></pre> <p>I can think of a few goals with this Tkinter GUI:</p> <ul> <li>Make Radiobuttons assign either a 0,1,2 or 3 to my variables(BAI_var1, BAI_var2, BAI_3 etc.)</li> <li>Make the "NEXT" &amp; "BACK" buttons show a different question every time you press it.</li> <li>Make a page at the end of the test that has multiple input fields for name, date, etc.</li> </ul> <p>I did not make the test!! I only made the software. The test was designed by David Burns and is available in his work book "The Feeling Good Book". </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload