タイムカレンダーを作成するためのコードを書いています。何らかの理由で、開始時刻と終了時刻のダイヤルが互いにミラーリングしています。私はすべてを見渡しましたが、コードがそのようなことをする理由は何もわかりません。Python Spin Boxesは互いにコピーしていますが、なぜ表示されませんか?
ここにコードはありますか?それはtextvariable
を持っている、それは略語としてtext
を受け入れていますいる:
from Tkinter import *
import math
Master = Tk()
def Value_Check():
Start_Hours = eval(Starting_Hours.get())
Start_Min = eval(Starting_Minutes.get())
End_Hours = eval(Ending_Hours.get())
End_Min = eval(Ending_Minutes.get())
Start_Time_Window = ((Start_Hours*60)+ Start_Min)
End_Time_Window = ((End_Hours*60)+ End_Min)
Total_Window = (Start_Time_Window - End_Time_Window)
Window_Hours = math.floor(Total_Window/60)
Window_Minutes = (Total_Window - Window_Hours)
print "You have a ", Window_Hours, "Hours and", Window_Minutes, "minute window to test"
Frame_Start_Window= Frame(Master)
Frame_Start_Window.pack()
#Setting the starting time of the testing window
Start_Time_Frame = Frame(Master)
Start_Time_Frame.pack(side = BOTTOM)
Starting_Title = Label(Frame_Start_Window, text = "When can you start testing? ")
Starting_Title.pack()
Starting_Hours = Spinbox(Frame_Start_Window, text = "Hour", from_ = 1, to = 24, wrap =True, width = 2, command = Value_Check)
Starting_Hours.pack(side = LEFT)
Collen_Title = Label(Frame_Start_Window, text = ":")
Collen_Title.pack(side = LEFT)
Starting_Minutes = Spinbox(Frame_Start_Window, text = "Minutes", from_ = 0, to = 59, wrap =True, width = 2, command = Value_Check)
Starting_Minutes.pack(side = LEFT)
#The end half of the testing window:
Frame_End_Window= Frame(Master)
Frame_End_Window.pack()
#Setting the starting time of the testing window:
End_Title = Label(Frame_End_Window, text = "What time do you HAVE to stop testing?")
End_Title.pack()
Ending_Hours = Spinbox(Frame_End_Window, text = "Hour", from_ = 1, to = 24, wrap =True, width = 2, command = Value_Check)
Ending_Hours.pack(side = LEFT)
Collen2_Title = Label(Frame_End_Window, text = ":")
Collen2_Title.pack(side = LEFT)
Ending_Minutes = Spinbox(Frame_End_Window, text = "Minutes", from_ = 0, to = 59, wrap =True, width = 2, command = Value_Check)
Ending_Minutes.pack(side = LEFT)
#Where the answer from the Test_Calculator button is displayed:
Results_Screen = Text(Master, height=2, width=65)
Results_Screen.pack()
Data_Reset = Button (Master, text = "Reset Values", command = Value_Check)
Data_Reset.pack()
mainloop()
ちょうどここまでですが、ユーザー入力に 'eval'を使用しないと、開始時間が' __import __( 'sys')。exit() 'であったという人となります。あなたが幸運であればそれが終わります。 – TigerhawkT3