Skip to content

Commit d6097a5

Browse files
author
mary
committed
Modern looking calculator
1 parent 327839c commit d6097a5

File tree

10 files changed

+60
-61
lines changed

10 files changed

+60
-61
lines changed
-41.5 KB
Binary file not shown.
-16.2 MB
Binary file not shown.

Moder_Calculator_IOS/widgets.py

-61
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"""
2+
You need to install the ttkbootstrap, pip install ttkbootstrap(I recomand to use a virtual environment)
3+
"""
4+
import ttkbootstrap as ttk
5+
from configuration import GAP_SIZE
6+
7+
8+
class OutputLabel(ttk.Label):
9+
"""
10+
Label for result and formula
11+
"""
12+
13+
def __init__(self, parent, style: str, string_var, row: int, anchor: str, column: int = 0) -> None:
14+
super().__init__(
15+
master = parent,
16+
style = style,
17+
textvariable = string_var,
18+
)
19+
self.grid(
20+
row = row,
21+
column = column,
22+
columnspan = 4,
23+
sticky = anchor
24+
)
25+
26+
27+
class Button(ttk.Button):
28+
"""
29+
The class for operators and numbers buttons
30+
"""
31+
32+
def __init__(self, parent, text: str, func, row: int, column: int, span: int, style: str) -> None:
33+
super().__init__(
34+
master = parent,
35+
text = text,
36+
style = style,
37+
command = func
38+
)
39+
self.grid(
40+
row = row,
41+
column = column,
42+
columnspan = span,
43+
sticky = 'news',
44+
padx = GAP_SIZE,
45+
pady = GAP_SIZE
46+
47+
)
48+
49+
50+
class NumberButtons(Button):
51+
def __init__(self, parent, text: str, style: str, func: str, row: int, column: int, span: int) -> None:
52+
super().__init__(
53+
parent = parent,
54+
text = text,
55+
style = style,
56+
func = lambda: func(text),
57+
span = span,
58+
row = row,
59+
column = column
60+
)

0 commit comments

Comments
 (0)