Форум сайта python.su
У меня есть код, написанный на Питоне с помощью ткинтера. В программе, которую он запускает есть путь из кнопок MONDAY > REGISTRATION. Как сделать так, чтобы при нажатии на кнопку REGISTRATION открывался проводник с определенной директорией, а не еще одно окно?
from tkinter import * from tkinter import messagebox import json from tkinter.filedialog import asksaveasfile root = Tk() root.title("Organaizer") root.resizable(0, 0) root.configure(bg='black') root.geometry('750x600') def reg1(): #os.system("start C:/Users/evamo/Documents/") monregles = Toplevel() #monregles.title("REGISTRATION") #monregles.resizable(0, 0) #monregles.configure(bg='black') #monregles.geometry('750x600') #monreg1notes = Frame(monregles, width=750, height=400, bg='white') #monreg1notes.grid(row=0, column=0) #monreg1view = Frame(monregles, width=750, height=200, bg='black') #monreg1view.grid(row=1, column=0) #notemonreg1 = Entry(monreg1notes, bg='yellow') #notemonreg1.pack() def mondays(): monles = Toplevel(root) monles.title("MONDAY") monles.resizable(0, 0) monles.configure(bg='black') monles.geometry('750x600') #def rl1(): # noterl1.pack() #def itgs1(): # noteitgs1.pack() #def maths1(): # notemaths1.pack() lesson = Frame(monles, width=750, height=600, bg='black') lesson.grid(row=0, column=0, padx=1, pady=1) registration = Button(lesson, text="Registration", fg='black', bg='white', font=20, width=85, height=6, command=reg1) registration.grid(row=0, column=0, sticky=S) literature = Button(lesson, text="Russian LIterature", fg='black', bg='white', font=20, width=85, height=6) literature.grid(row=1, column=0, sticky=S) itgs = Button(lesson, text="ITGS", fg='black', bg='white', font=20, width=85, height=6) itgs.grid(row=2, column=0, sticky=S) maths = Button(lesson, text="Maths", fg='black', bg='white', font=20, width=85, height=6) maths.grid(row=3, column=0, sticky=S) #notereg1 = Entry(notes, width=375, height=300, bg='white') #notereg1.pack() #noterl1 = Entry(notes, width=375, height=300, bg='white') #notereg1.pack() #noteitgs1 = Entry(notes, width=375, height=300, bg='white') #notereg1.pack() #notemath1 = Entry(notes, width=375, height=300, bg='white') #notereg1.pack() lu = Frame(root, width=250, height=200, bg='white') lu.grid(row=0, column=0, padx=1, pady=1, sticky=N) tp = Frame(root, width=250, height=200, bg='white') tp.grid(row=0, column=1, padx=1, pady=1, sticky=N) ru = Frame(root, width=250, height=200, bg='white') ru.grid(row=0, column=2, padx=1, pady=1, sticky=N) lt = Frame(root, width=250, height=200, bg='white') lt.grid(row=1, column=0, padx=1, pady=1, sticky=N) md = Frame(root, width=250, height=200, bg='white') md.grid(row=1, column=1, padx=1, pady=1, sticky=N) rt = Frame(root, width=250, height=200, bg='white') rt.grid(row=1, column=2, padx=1, pady=1, sticky=N) bt = Frame(root, width=250, height=200, bg='white') bt.grid(row=2, column=1, padx=1, pady=1, sticky=N) mday = Button(lu, text="MONDAY", fg='black', bg='white', font=150, width=27, height=10, command=mondays) mday.pack() tday = Button(tp, text="TUESDAY", fg='black', bg='white', font=150, width=27, height=10) tday.pack() wday = Button(ru, text="WEDNESDAY", fg='black', bg='white', font=150, width=27, height=10) wday.pack() thday = Button(lt, text="THURSDAY", fg='black', bg='white', font=150, width=27, height=10) thday.pack() fday = Button(md, text="FRIDAY", fg='black', bg='white', font=150, width=27, height=10) fday.pack() saday = Button(rt, text="SATURDAY", fg='black', bg='white', font=150, width=27, height=10) saday.pack() sday = Button(bt, text="SUNDAY", fg='black', bg='white', font=150, width=27, height=10) sday.pack() root.mainloop()
Офлайн
https://docs.python.org/3/library/subprocess.html
Офлайн