Career,  Lifestyle,  News,  Science,  Tech

7 steps to install Tkinter and run a ‘Hello World’ file

  1. Download Visual Studio Code
  2. Create a new file for example main.py
  3. Check python version type python –version in the terminal
  4. Check the version of pip and execute the command pip -V
  5. Create a new virtual environment execute the command python -m venv /path/to/new/virtual/environment
  6. Install Tkinter pip install tk
  7. Import Tkinter and run a “Hello World” file

# Python tkinter hello world program

fromtkinter import*

root =Tk()

a =Label(root, text ="Hello World")

a.pack()

root.mainloop()

Then run the file, below is the result of your tkinter hello world program.


You cannot copy content of this page