Python Forum
[Tkinter] On Win 10, no graphical window when run code - 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: [Tkinter] On Win 10, no graphical window when run code (/thread-30654.html)

Pages: 1 2


On Win 10, no graphical window when run code - ma2020uk - Oct-30-2020

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()



RE: On Win 10, no graphical window when run code - DT2000 - Oct-31-2020

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.


RE: On Win 10, no graphical window when run code - ma2020uk - Nov-01-2020

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 ?


RE: On Win 10, no graphical window when run code - Larz60+ - Nov-01-2020

This works for me on Linux Mint 20 without modification.:
[attachment=1037]


RE: On Win 10, no graphical window when run code - deanhystad - Nov-01-2020

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.


RE: On Win 10, no graphical window when run code - ma2020uk - Nov-01-2020

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.


RE: On Win 10, no graphical window when run code - Larz60+ - Nov-01-2020

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-from-start?highlight=VSCode

This is a better product for python.


RE: On Win 10, no graphical window when run code - deanhystad - Nov-02-2020

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.


RE: On Win 10, no graphical window when run code - Larz60+ - Nov-02-2020

No, Deanstead, VSCode is not the same as Visual studio code.
VSCode is a separate IDE.


RE: On Win 10, no graphical window when run code - deanhystad - Nov-02-2020

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.