Hi evryone!!
I' m very new not only to Python and Tkinter but to programing.
I'm a bit stuck here and would be grateful for some help.
I have 3 radio select buttons(see below) which I want to link to a pmw dialog with (apply and cancel options ) i.e. when I press enable btn dialog pops up and asks to confirm the my choice and if apply is selected then run my enable script if cancel then close the dialog. the same with the other radio buttons,if disable is selected then the same dialog appears and ask again to apply or cancel.
So far I got the buttons working and I get the different values printed on the console and if I uncoment the second ""choice=v.bloc k..."" this runs the script but at the moment from the "test" button. I don't need the buton and the console output instead I just want to be able to responce to the buttons via the dialog. I not sure if this makes any sence . this is some of my code so far.
thanks
I' m very new not only to Python and Tkinter but to programing.
I'm a bit stuck here and would be grateful for some help.
I have 3 radio select buttons(see below) which I want to link to a pmw dialog with (apply and cancel options ) i.e. when I press enable btn dialog pops up and asks to confirm the my choice and if apply is selected then run my enable script if cancel then close the dialog. the same with the other radio buttons,if disable is selected then the same dialog appears and ask again to apply or cancel.
So far I got the buttons working and I get the different values printed on the console and if I uncoment the second ""choice=v.bloc k..."" this runs the script but at the moment from the "test" button. I don't need the buton and the console output instead I just want to be able to responce to the buttons via the dialog. I not sure if this makes any sence . this is some of my code so far.
thanks
Code:
def myDialog(w): dialog = Pmw.Dialog(root, buttons=('Apply', 'Cancel'),defaultbutton='Apply',title='ConfirmSelection',command=block_firewall()) return w def block_firewall(): pipe_block = os.popen("./block-iptables", 'r') def call(): choice = v.get() #choice= v.block_firewall() print '"Input %s "' % variant #if choice global v v = IntVar() radiobutton = Radiobutton(frame,text= "Enable", variable=v, value="1") radiobutton.pack(side=TOP,anchor=W) radiobutton = Radiobutton(frame,text= "Disable", variable=v, value="2") radiobutton.pack(side=TOP,anchor=W) radiobutton = Radiobutton(frame,text= "Block All", variable=v, value="3") radiobutton.pack(side=TOP,anchor=W) radiobutton.select() test = Button(frame,text="Select",command=call) test.pack()
Comment