0

When I run this code, it opens all the windows instead of opening the certain one when the button is pressed

import tkinter as tk
import mysql.connector

window = tk.Tk()

def intro():
    introducere = tk.Toplevel(window)

def search():
    searchdb = tk.Toplevel(window)

window.eval('tk::PlaceWindow %s center' % window.winfo_pathname(window.winfo_id()))

window.geometry("150x100")

window.title("Kys House")

introButton = tk.Button(window, text = "Introdu in baza de date", fg = "black", command = intro()).pack()

searchButton = tk.Button(window, text = "Cauta in baza de date", fg = "black", command = search()).pack()

window.mainloop()
Viorel Andrei Chis
  • 147
  • 2
  • 2
  • 10

0 Answers0