Skip to content

Commit 441fdef

Browse files
authored
Update README.md
1 parent 5e8cdf7 commit 441fdef

File tree

1 file changed

+70
-1
lines changed

1 file changed

+70
-1
lines changed

README.md

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,70 @@
1-
# tutorialWindowPython
1+
# Create a window using an exernal file
2+
3+
File name : _window.py_
4+
5+
compile file in a venv environement :
6+
```bash
7+
8+
mkdir PythonTuto
9+
cd PythonTuto
10+
# For linux (module venv of Python)
11+
python3 -m venv env
12+
# Windows
13+
python -m venv env
14+
15+
#code into the env using command
16+
# Linux
17+
source env/bin/activate
18+
19+
# Window
20+
env/Scripts/activate
21+
22+
```
23+
Python Code example using Tkinter
24+
25+
```bash
26+
#Linux and Window --> in venv
27+
pip install tkinter
28+
# Or
29+
sudo apt install python3-tk
30+
```
31+
32+
External file
33+
```bash
34+
window.py :
35+
```
36+
37+
```python
38+
39+
import tkinter as tk
40+
41+
#traditional form
42+
root = tk.Tk()
43+
root.geometry("500x500")
44+
root.title("Tkinter tutorial")
45+
46+
root.mainloop()
47+
48+
49+
# My form
50+
def createWindow(title, size):
51+
window = tk.Tk()
52+
window.geometry(size)
53+
window.title(title)
54+
return window
55+
56+
```
57+
58+
In the main script :
59+
```bash
60+
main.py
61+
```
62+
63+
```python
64+
65+
import window as win
66+
67+
root = win.createWindow("A Tk window", "500x500")
68+
root.mainloop
69+
70+
```

0 commit comments

Comments
 (0)