我如何制作一个按钮以转到python中的下一页(文件)?

时间:2018-08-15 16:50:57

标签: python tkinter

我试图制作一个转到下一个文件的按钮,就像页面在html中一样。因此,您知道每当您制作一个按钮转到html的下一页时,我都需要帮助,但需要使用python语言。您能理解我的问题吗?您能帮助我吗?我已经按下按钮,但是我不知道该如何命令。这是命令oh的python程序,文件名为GraphicsWindow.py:

from tkinter import *

tk = Tk()

#make window
tk.title("Labeler")
tk.geometry("200x400")
tk.configure(background="darkgrey")
#make frame
app = Frame(tk, bg="darkgrey")
app.grid()
label = Label (app, text = "Welcome!", bg="darkgrey", font="Times 30 bold")

#make variables
counter1 = 0
counter2 = 0

#make functions
label.grid()
def function1():
    global counter1
    counter1 += 1
    print("Play the game", counter1)
    label.grid()

def function2():
    global counter2
    counter2 += 1
    print("Go to options", counter2)

#make button1
button1 = Button (app, text = "Play", bg="darkgrey", font="none
25",command=function1) 
button1.grid()
button2 = Button (app, text = "Options", bg="darkgrey", font="none 25",    
command=function2)
button2.grid()
button3 = Button (app, text = "Exit", bg="darkgrey", font="none 25", 
command=exit)
button3.grid()


tk.mainloop()

0 个答案:

没有答案