Skip to content

Commit d552669

Browse files
committed
26.11.2022
1 parent 68bb660 commit d552669

File tree

10 files changed

+121
-0
lines changed

10 files changed

+121
-0
lines changed

Diff for: 001_pytk_todo_app/main_v1.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python3
2+
13
import tkinter as tk
24

35
class Todo(tk.Tk):

Diff for: 002_tk_file.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from tkinter import *
2+
3+
root = Tk()
4+
5+
root.mainloop()

Diff for: 026_pytk_multiple_frames/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python Simple Window
2+
3+
![img](Screenshot_01.png)

Diff for: 026_pytk_multiple_frames/Screenshot_01.png

5.34 KB
Loading

Diff for: 026_pytk_multiple_frames/main.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env python3
2+
# https://zetcode.com/tkinter/introduction/
3+
4+
from tkinter import Tk, BOTH, Text, TOP, X, N, LEFT
5+
from tkinter.ttk import Frame, Label, Entry
6+
7+
class Example(Frame):
8+
9+
def __init__(self):
10+
super().__init__()
11+
12+
self.initUI()
13+
14+
def initUI(self):
15+
self.master.title("Simple window")
16+
self.pack(fill=BOTH, expand=1)
17+
# -----------------------------------------------Frame1
18+
frame1 = Frame(self)
19+
frame1.pack(fill=X)
20+
21+
lbl1 = Label(frame1, text="Title", width=6)
22+
lbl1.pack(side=LEFT, padx=5, pady=5)
23+
24+
entry1 = Entry(frame1)
25+
entry1.pack(fill=X, padx=5, expand=True)
26+
# ------------------------------------------------Frame2
27+
frame2 = Frame(self)
28+
frame2.pack(fill=X)
29+
30+
lbl2 = Label(frame2, text="Author", width=6)
31+
lbl2.pack(side=LEFT, padx=5, expand=True)
32+
33+
entry2 = Entry(frame2)
34+
entry2.pack(fill=X, padx=5, expand=True)
35+
36+
37+
def main():
38+
root = Tk()
39+
root.geometry("250x150+300+300")
40+
app = Example()
41+
root.mainloop()
42+
43+
if __name__ == "__main__":
44+
main()
45+
46+
47+

Diff for: 027_pytk_fibonacci_window/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Python Simple Window
2+
3+
![img](Screenshot_01.png)

Diff for: 027_pytk_fibonacci_window/Screenshot_01.png

5.34 KB
Loading
624 Bytes
Binary file not shown.

Diff for: 027_pytk_fibonacci_window/fibonacci.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
3+
def Fibonacci(n):
4+
if n<0 :
5+
print ("Alegerea este incorecta!")
6+
7+
elif n == 0 :
8+
return 0
9+
10+
elif n == 1 or n == 2 :
11+
return 1
12+
else :
13+
return Fibonacci(n-1) + Fibonacci(n-2)
14+
15+
16+
# print(Fibonacci(5))

Diff for: 027_pytk_fibonacci_window/main.py

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env python3
2+
# https://zetcode.com/tkinter/introduction/
3+
4+
from tkinter import Tk, BOTH, Entry, Button
5+
from tkinter.ttk import Frame
6+
import fibonacci
7+
8+
9+
class Example(Frame):
10+
11+
def __init__(self):
12+
super().__init__()
13+
14+
self.initUI()
15+
16+
def initUI(self):
17+
self.master.title("Simple window")
18+
self.pack(fill=BOTH, expand=1)
19+
20+
self.fib_ent = Entry(self)
21+
self.fib_ent.pack()
22+
23+
self.fib_ext = Entry(self)
24+
self.fib_ext.pack()
25+
26+
cal_btn = Button(self, text="Calculeaza", command=self.f_calc)
27+
cal_btn.pack()
28+
29+
def f_calc(self):
30+
print(self.fib_ent.get())
31+
fib = int(self.fib_ent.get())
32+
fib2 = str(fibonacci.Fibonacci(fib))
33+
self.fib_ext.insert(0,fib2)
34+
35+
def main():
36+
root = Tk()
37+
root.geometry("250x150+300+300")
38+
app = Example()
39+
root.mainloop()
40+
41+
if __name__ == "__main__":
42+
main()
43+
44+
45+

0 commit comments

Comments
 (0)