当我打开一个文件对话框然后将其他内容写入根目录时,我可以使用向上和向下箭头更改旋转框的值,但我无法单击并写入它。我在这里做错了什么?这是一个已知的错误?
当我不打电话filedialog.askopenfilename
并手动输入路径时,它工作正常..
编辑:
当我单击组合框的下拉箭头一次时,我可以写入它?!
from tkinter import filedialog, messagebox, Spinbox, Label, Frame, StringVar, Tk, Button, ttk
colors = ["magma", "inferno", "YlOrBr", "YlOrRd", "Wistia"]
# Pfad einlesen
def readPath():
sheetPath = filedialog.askopenfilename(title = "Choose File",filetypes = (("all files","*.*"),(".xls","*.xls"),(".xlsx","*.xlsx")))
# sheetPath = "C:/Users/leoch/trends.xls"
class Window(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.master = master
sensorData = readPath()
lb = Label(root, text="Settings") #, padx=20, pady=20
lb.pack()
root.title("Settings")
textStart = Label(root, text="From Row: ")
textStart.pack()
tvOffset = StringVar(root)
tvOffset.set=(18)
spinStart = Spinbox(root, from_=18, to=20, width=7, textvariable=tvOffset)
spinStart.pack()
labelFarben = Label(root, text="Colors")
labelFarben.pack()
comboFarben = ttk.Combobox(root, values=colors)
comboFarben.current(0)
comboFarben.pack()
def confirm():
root.withdraw()
# visualization(sensorData, rowStart, rowCount, fps, interpolation, farben)
confirm = Button(root, text="Bestätigen", command=confirm, font=20, padx=20, pady=10, border=2, fg="green")
confirm.pack(padx=20, pady=20)
root = Tk()
app = Window(root)
root.wm_title("Wäremstromvisualisierung")
root.mainloop()