![]() |
GUI created in Tkinter does NOT show up - 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: GUI created in Tkinter does NOT show up (/thread-44234.html) |
GUI created in Tkinter does NOT show up - RCasanuevaU - Apr-09-2025 Hello, I've just joined this forum and and I hope I can be usefull in the near future. I have always been autodidact in the programming area, starting many years ago with Fortran IV, Pascal, DbaseIV. Currently I have a very respectable level in developing solutions and applications in VBA for both MS Excel and MS Access. Currently I am trying to replicate an application in MS Access in open-code platforms and languages. Specifically, MySql and Python. Well, let's go to the point. I use Visual Studio Code as my editor. And I am just starting in learning Tkinter for developing the GUI's necesary for my application. I've written the simpliest code possible as a starting point: import tkinter as tk ventana=tk.Tk() ventana.geometry("400x300") ventana.title("Mi primera Ventana") ventana.mainloopThe problem is: 1.- After using the RunCode command, the program is executed with no errors, but the window created does NOT show up. 2.- I checked in the terminal and both, Python and Tkinter are correctly installed and the versions are Python 3.13.2 and Tcl/Tk 8.6.15 3.- In fact after entering the command 'python -m tkinter' on the terminal's command line, the test window succesfully appears. 4.- I have searched on the internet; Google, Youtube etc. with no results Any orientation will be very much appreciated RE: GUI created in Tkinter does NOT show up - buran - Apr-09-2025 You need to call mainloop :ventana.mainloop() RE: GUI created in Tkinter does NOT show up - DeaD_EyE - Apr-09-2025 Change ventana.mainloop to ventana.mainloop() .Without the parenthesis, you do not call the function, but it's still valid code. This is why there is no exception. The mainloop is not called, which is a blocking function. Then the program just ends. RE: GUI created in Tkinter does NOT show up - RCasanuevaU - Apr-09-2025 Thank you very much. I added the "()" and worked. It is embarrassing having not noticed the mistake before. Apprediated !! |