1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| window = Tk()
window.geometry('1024x768+0+0')
menu = Menu(window)
new_item = Menu(menu, tearoff=0)
new_item.add_command(label='Open', underline=0)
new_item.add_separator()
window.config(menu=menu)
btnOpen_logo = PhotoImage(file="C:/................/open64.png")
btnOpen = Button(window, text= "Open file", image=btnOpen_logo, command=openFileDialog)
btnOpen.grid(column=1, row=0)
btnOpen.bind("<Enter>", btOpenTextOnMouseOver)
btnOpen.bind("<Leave>", btOpenTextOnMouseLeave)
# listbox VARs
lbl_var = Label(window, text="Variables:", font=("Arial Bold", 15))
lbl_var.place(x=10, y=85)
lb = Listbox(window, width=60, height=14)
lb.place(x=10, y=120)
lb.bind("<<ListboxSelect>>", lbOnSelect)
scrollbar = Scrollbar(lb, orient="vertical")
scrollbar.place(x=345, y=0)
# treeview VAL
lbl_val = Label(window, text="Values:", font=("Arial Bold", 15))
lbl_val.place(x=400, y=85)
tree = Treeview()
minwidth = tree.column('#0', option='minwidth') #minimize 1st column
tree.column('#0', width=minwidth) #minimize 1st column
tree["columns"]=("TS","VAL")
tree.column("TS", width=150 )
tree.column("VAL", width=150)
tree.heading("TS", text="Timestamp", anchor='w')
tree.heading("VAL", text="Value", anchor='w')
window.mainloop() |
Partager