-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fibonacci_OOP.py
61 lines (49 loc) · 2.01 KB
/
Fibonacci_OOP.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from Fibonacci import fibonacci
from time import *
from tkinter import *
from tkinter import messagebox
from tkinter.ttk import *
from nuppudega_oo_konn import KonnaRakendus
class FibonacciFrame(Frame):
def __init__(self, parent):
#Kutsume valja ylemklassi __init__ meetodit
super().__init__(parent)
# tekitame sisendi muutuja ja valikukasti
self.n_var = IntVar()
arvud20ni = list(range(1,100))
n_combo = Combobox(self, textvariable=self.n_var, values = arvud20ni)
n_combo.grid(row=0,column=0)
n_combo.bind('<<ComboboxSelected>>', self.arvuta_fibo)
#Tekitame valjundi muutuja ja tekstikasti
self.fibo_var = IntVar()
fibo_entry = Entry(self, textvariable = self.fibo_var)
fibo_entry.grid(row=0,column=1)
def arvuta_fibo(self,event):
#print(event.__dict__)
vastus = fibonacci(self.n_var.get())
self.fibo_var.set(vastus)
def about():
messagebox.showinfo(title="About", message="Fibbonacci jada arvutamise rakenduse versioon 0.1")
def help_us():
messagebox.showinfo(title="Help", message="Valige vasakust kastist arv ja vaadake valjundit")
if __name__ == '__main__':
def frog_window():
global root
uus_aken = Toplevel(root)
uus_aken.rowconfigure(0,weight=1)
uus_aken.columnconfigure(0,weight=1)
kr = KonnaRakendus(uus_aken)
kr.grid(row=0,column=0,sticky=(N,S,W,E))
root = Tk()
minu_rakendus = FibonacciFrame(root)
#Tekitame rakensulele menyy
menubar= Menu(root)
menubar.add_command(label='Frog', command=frog_window)
info_submenu = Menu(menubar)
info_submenu.add_command(label='Help', command=help_us)
info_submenu.add_command(label='About',command=about)
menubar.add_cascade(menu = info_submenu, label="Info")
root.config(menu=menubar)
#Paigutame minu_rakendus Frame'i
minu_rakendus.grid(row=0,column=0)
root.mainloop()