1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| import tkinter as tk
class Application(tk.Tk):
def __init__(self):
# super().__init__()
tk.Tk.__init__(self)
self.title("Principale")
self.geometry("300x300")
tk.Button(self, text ='Fenêtre 2', command=self.open_window).grid(row=0, column=0)
def open_window(self):
window = Win2(self)
window.grab_set()
class Win2(tk.Toplevel):
# def __init__(self, parent):
# super().__init__(parent)
def __init__(self):
Application.__init__(self)
self.title("Fenêtre 2")
self.geometry("800x300") |
Partager