Functions with Tkinter - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: Functions with Tkinter (/thread-23519.html) |
Functions with Tkinter - Reldaing - Jan-03-2020 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() RE: Functions with Tkinter - Larz60+ - Jan-03-2020 you'll find a good example here: https://runestone.academy/runestone/books/published/thinkcspy/GUIandEventDrivenProgramming/06_command_events.html RE: Functions with Tkinter - Reldaing - Jan-03-2020 Thx bro |