Python 图形界面元素
from tkinter import *
import os
def button_click1():
try:
filePath = r'D:\CloudMusic'
os.system("explorer.exe %s"%filePath)
app.destroy()
except Exception as ex:
print(ex)
def test_scale(v):
print(v)
print(scaleVal.get())
def test_checkButton():
print(track_playing.get())
app = Tk()
app.title("Your tkinter application")
app.geometry('300x100+200+100')
b1 = Button(app,text = "Right",width = 10,command = button_click1)
b1.pack(side = 'left',padx = 10,pady = 10)
track_playing = IntVar()
c1_button = Checkbutton(app,variable=track_playing,command = test_checkButton,text = "music").pack()
scaleVal = DoubleVar()
scale_volume = Scale(app,
variable=scaleVal,
from_=0.0,
to=1.0,
resolution=0.1,
command=test_scale,
label="Volume",
orient=HORIZONTAL).pack()
app.protocol("WM_DELETE_WINDOW",button_click1)
#-app.protocol("WM_SAVE_YOURSELF",button_click1)
#app.protocol("WM_TAKE_FOCUS",button_click1)
app.mainloop()



浙公网安备 33010602011771号