def AObutton(self, graphnum):
toplvl = tk.Toplevel()
toplvl.withdraw()
frame = ttk.Frame(toplvl, padding=[2, 3, 3, 0])
boxwidth = 15
#Create the labels
lbl = ttk.Label(frame, text='Label')
CreateToolTip(lbl, \
'This text will show up in the legend and the log file')
lbl.grid(row=0, column=1)
mult = ttk.Label(frame, text='Multiplier')
CreateToolTip(mult, \
'Multiply by this value')
mult.grid(row=0, column=2)
offset = ttk.Label(frame, text='Offset')
CreateToolTip(offset, \
'Add this value. Happens AFTER the data is multiplied')
offset.grid(row=0, column=3)
dashed = ttk.Label(frame, text='Dashed')
CreateToolTip(dashed, \
'If checked, the line will be dashed')
dashed.grid(row=0, column=4)
ttk.Label(frame, text='Line 1').grid(row=1, column=0, padx=2)
ttk.Label(frame, text='Line 2').grid(row=2, column=0, padx=2)
ttk.Label(frame, text='Line 3').grid(row=3, column=0, padx=2)
for row in range(1,3+1):
key = 'graph'+str(graphnum)+'line'+str(row)
#Label
ttk.Entry(frame, width=boxwidth, \
textvariable=self.controller.TKvariables[key][0]).grid(row=row, column=1)
#Multiplier
ttk.Entry(frame, width=boxwidth, \
textvariable=self.controller.TKvariables[key][4]).grid(row=row, column=2)
#Offset
ttk.Entry(frame, width=boxwidth, \
textvariable=self.controller.TKvariables[key][5]).grid(row=row, column=3)
#Dashed
ttk.Checkbutton(frame, onvalue='--', offvalue='-', \
variable=self.controller.TKvariables[key][3]).grid(row=row, column=4)
ttk.Button(frame, text='OK', command=toplvl.destroy).grid(row=5,\
column=3, columnspan=2, sticky='ew', pady=4)
#Center the window
frame.grid()
toplvl.update()
scrwidth = toplvl.winfo_screenwidth()
scrheight = toplvl.winfo_screenheight()
winwidth = toplvl.winfo_reqwidth()
winheight = toplvl.winfo_reqheight()
winposx = int(round(scrwidth/2 - winwidth/2))
winposy = int(round(scrheight/2 - winheight/2))
toplvl.geometry('{}x{}+{}+{}'.format(winwidth, winheight, winposx, winposy))
toplvl.deiconify()
评论列表
文章目录