Python Forum

Full Version: Functions with Tkinter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there, I'm new to tkinter. I want to create a window, in which a button appears. I managed to make this first step. The issue is that I want when you click the button , a function which contains inputs appears. I tried the last 3 days but no idea how do to do it. The code shows me the window, but the function is made in the console and in the window. I hope you understood. Thanks a lot for reading my message and helping me .

import tkinter
from tkinter import *

def retraite_fonctionnaire():
    i=input("Your name: ")
    k=input("Date of birth ?: ")
    revenu_moyen=int(input("Your salary: "))
    trimestre_cotisés = int(input("Number of years working ?: " ))
    enfants = int(input("Number of child ?: " ))
    

#adding text
label_title= Label(frame, text="Hi there", font=("scrubble", 45), bg="#205BA9",fg="white", bd=1, relief=SUNKEN)
label_title.pack()

#first function
retraite_simple= Button(frame, text="Continue", font=("scrubble", 25), bg="white",fg="#205BA9", command=retraite_fonctionnaire )
retraite_simple.pack(pady=25, fill=X)

frame.pack(expand=YES)
window.mainloop()
Thx bro Thumbs Up