Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

4 Commits

Repository files navigation

Create a window using an exernal file

File name : window.py

compile file in a venv environement :

mkdir PythonTuto
cd PythonTuto
# For linux (module venv of Python)
python3 -m venv env
# Windows
python -m venv env
#code into the env using command# Linuxsource env/bin/activate
# Window
env/Scripts/activate

Python Code example using Tkinter

#Linux and Window --> in venv
pip install tkinter
# Or
sudo apt install python3-tk

External file

window.py :
importtkinterastk#traditional formroot=tk.Tk()
root.geometry("500x500")
root.title("Tkinter tutorial")
root.mainloop()
# My formdefcreateWindow(title, size):
window=tk.Tk()
window.geometry(size)
window.title(title)
returnwindow

In the main script :

main.py
importwindowaswinroot=win.createWindow("A Tk window", "500x500")
root.mainloop

Releases

Packages

Contributors

Languages