Python Forum
[Tkinter] On Win 10, no graphical window when run code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] On Win 10, no graphical window when run code
#1
Hi
I am learning Python TKInter GUI.
I run following code on my Desktop running windows 10. The code runs but no root window appears.
If I run same code on my laptop, it works fine.
I use Sublime text. I also use Atom. Same problem with both.
I installed newer python-3.9.0-amd64 . Before I was using 3.8.2-amd64.
Problem still the same.
My computer has graphics card recently installed : ATI AMD Radeon HD 7000 series
Previously I was using motherboard graphics when I did not have this issue.
Could the card be causing problem ?
Help !
from tkinter import *

root = Tk()
myLabel = Label(root, text = ' Hello World !')
myLabel.pack()
root.mainloop()
Larz60+ write Nov-01-2020, 06:05 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.

I fixed for you this time. Please use bbcode tags on future posts. Thank you.
Reply
#2
Please place all code and errors in their respective tags when posting.
from tkinter import *
root = Tk()
root.geometry('200x200')
myLabel = Label(root, text = ' Hello World !')
myLabel.pack()
root.mainloop()
This code works fine and generates a small GUI.
I do not know what display setting you are using on your system so I added a small line to change the size of the GUI.
Reply
#3
Hi
I tried different setting for display. Also changed root window geometry. Problem still the same. No window.
I thought maybe problem is with the Graphics card. I am using ATI AMD Radeon HD7000 series (Dell).
I read somewhere that Python GUI supported for NVIDIA cards only. If this is true then the problem may be the graphics card I am using ( I installed this recently). I did not have problem when I was using motherboard graphics.
Can I use the graphics card or do I need to go back to using graphics on motherboard ?
Reply
#4
This works for me on Linux Mint 20 without modification.:
   
Reply
#5
Your code works fine on Python 3.8 running on Windows 10. The window is small, but there is a window. I ran it from Idle and Visual Studio Code and I also ran it from the cmd window using "python helloworld.py" All worked the same for me.
Reply
#6
Hi,
I ran code under python 3.9.0 IDLE and Visual Studio Code. It ran without problems. Still not run under Sublime text 3 or Atom. So problems is not the graphics card ! Still confused but I will switch to using Visual Studio Code. I was leaving using it until later but seems a good time to start learning/using it.
Thanks to all who replied.
Reply
#7
instead of using Visual Studio Code, use VSCode see: https://code.visualstudio.com/
And follow this to install: https://python-forum.io/Thread-VS-Code-f...ght=VSCode

This is a better product for python.
Reply
#8
The link you provide is to Visual Studio Code which I guess is the same as VSCode. I installed Visual Studio Code (which is completely different than Visual Studio) and it looks exactly like the screen shot in you link and calls itself Visual Studio Code when you open the About dialog.
Reply
#9
No, Deanstead, VSCode is not the same as Visual studio code.
VSCode is a separate IDE.
Reply
#10
If what you linked to is VSCode can you provide a link to Visual Studio Code please? The 2 names apper to refer to the same thing everywhere I look. Confusing.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Embedding Matplotlib in graphical user interfaces bobthebuilder 2 926 May-19-2020, 09:42 PM
Last Post: bobthebuilder
  tkinter window and turtle window error 1885 3 1,645 Nov-02-2019, 12:18 PM
Last Post: 1885
  [Tkinter] my simple window code is not working antonmichel 8 4,158 Jan-29-2018, 06:24 PM
Last Post: Larz60+
  update a variable in parent window after closing its toplevel window gray 5 4,226 Mar-20-2017, 10:35 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020