Answer the question
In order to leave comments, you need to log in
Why does the button open two windows at once instead of one?
Open the program and follow this path MONDAY > REGISTRATION. When you click on the latter, two windows will pop up: MONDAY and REGISTRATION. I need to open only REGISTRATION, without MONDAY.
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 mondays():
monles = Toplevel(root)
monles.title("MONDAY")
monles.resizable(0, 0)
monles.configure(bg='black')
monles.geometry('750x600')
def reg1():
monregles = Toplevel(mondays())
monregles.title("REGISTRATION")
monregles.resizable(0, 0)
monregles.configure(bg='black')
monregles.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()
Answer the question
In order to leave comments, you need to log in
Try to take out def reg1 (): from child def mondeys (): perhaps when opening one, the second one opens by "inertia". (DO NOT HIT I'm a "novice" myself)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question