Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- myWindow=Tk()
- myTitle='ICCESS Sphincter Actuator V1.0'
- myWindow.title(myTitle)
- v = StringVar(myWindow, "1")
- retVal = v.get()
- def onRbClick():
- retVal=v.get()
- myTitle='RB: '+retVal
- myWindow.title(myTitle)
- rb1 = Radiobutton(myWindow, text = 'Cable-driven', variable = v, value = '1', command=onRbClick)
- rb1.grid(row=0, column=0, padx=10, pady=10, sticky='NW')
- rb2 = Radiobutton(myWindow, text = 'Pneumatic-bellows', variable = v, value = '2', command=onRbClick)
- rb2.grid(row=0, column=1, padx=10, pady=10, sticky='NW')
- def connect():
- xx=ev.get()
- myWindow.title(xx)
- frm1 = Frame(myWindow)
- frm1.grid(row=0, column=2)
- ev = StringVar(myWindow, 'COM1')
- ent1 = Entry(frm1, width='10', textvariable = ev)
- ent1.pack(side=LEFT, padx=5)
- btn_connect = Button(frm1, text='Connect', command=connect)
- btn_connect.pack(side=LEFT, padx=5)
- btn_close = Button(myWindow, text='Close', command=exit)
- #btn_close.pack(padx=100, pady=50)
- btn_close.grid(row=0, column=3, padx=10, pady=10)
- def onBtClick(event):
- theW = event.widget
- print(theW.cget('text'))
- if myWindow.cget('bg')=='green':
- myWindow.configure(bg='gray')
- else:
- myWindow.configure(bg='green')
- hsimg = PhotoImage(file = r"hs.png")
- # hsimg = hsimg0.subsample(3,3)
- dsimg = PhotoImage(file = r"ds.png")
- crimg = PhotoImage(file = r"cr.png")
- wsimg = PhotoImage(file = r"ws.png")
- #btn_hs=Button(myWindow, text='Healthy Squeeze', image=hsimg, compound=TOP, command=onBtClick)
- btn_hs=Button(myWindow, text='Healthy Squeeze', image=hsimg, compound=TOP)
- btn_hs.bind("<Button-1>", onBtClick)
- btn_ds=Button(myWindow, text='Decay Squeeze', image=dsimg, compound=TOP)
- btn_ds.bind("<Button-1>", onBtClick)
- btn_cr=Button(myWindow, text='Cough Reflex', image=crimg, compound=TOP)
- btn_cr.bind("<Button-1>", onBtClick)
- btn_ws=Button(myWindow, text='Week Squeeze', image=wsimg, compound=TOP)
- btn_ws.bind("<Button-1>", onBtClick)
- btn_hs.grid(row=2, column=0, ipadx=10, pady=10)
- btn_ds.grid(row=2, column=1, ipadx=10, pady=10)
- btn_cr.grid(row=2, column=2, ipadx=10, pady=10)
- btn_ws.grid(row=2, column=3, ipadx=10, pady=10)
- myWindow.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement