Feb-02-2019, 12:08 AM
from tkinter import * root = Tk() root.title('Register') def status(): word = varr.get() gender = var.get() if gender == 1: text.insert(END,f'Hi Mr {word}\nHow are you doing today?') else: text.insert(END, f'Hi Miss {word}\nHow are you doing today?') varr = StringVar() entryfield = Pmw.EntryField(root,labelpos=W,label_text='Name:',entry_width=22,entry_textvariable=varr) entryfield.grid(row=0,column=0,sticky=W,padx=5,pady=5) button = Button(root,text='Status',command=status) button.grid(row=0,column=0,sticky=E,padx=5,pady=5,ipadx=10) var = IntVar() f = Frame(root) f.grid() for i,k,j in [('Male',1,0),('Female',1,1)]: radiobutton = Radiobutton(f,text=i,variable=var,value=i,indicatoron=0) radiobutton.grid(row=k,column=j,sticky=W,padx=5,pady=5,ipadx=30) frame = Frame(root) frame.grid() text = Text(frame,width=30,height=5) text.grid(row=2,column=0,padx=5,pady=5) root.mainloop()Please, how can I click on either of the RadioButtons and then the 'Status' Button and get the appropriate text inserted into my Text widget.
I tried doing it but I got this error: _tkinter.TclError: expected floating-point number but got "Male".
Thanks.