Skip to content

Commit 002263e

Browse files
committed
Refactoring. tkinter_examples/. Adding the None annotation to the return value
1 parent a26afd1 commit 002263e

27 files changed

Lines changed: 51 additions & 51 deletions

‎tkinter_examples/Entry_Button__on_click.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from tkinter import messagebox
99

1010

11-
def on_button_clicked():
11+
def on_button_clicked() -> None:
1212
try:
1313
w = int(weight.get())
1414
h = int(height.get())

‎tkinter_examples/build_example/main.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
log.pack(side="top", fill="both", expand="true")
2727

2828

29-
def loopproc():
29+
def loopproc() -> None:
3030
print("Hello " + name.get() + "!")
3131
tk.after(1000, loopproc)
3232

‎tkinter_examples/button__change_button_icon_on_click/main.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tkinter as tk
88

99

10-
def _on_button_click(button):
10+
def _on_button_click(button) -> None:
1111
global PHOTO_COUNTER
1212
PHOTO_COUNTER += 1
1313
if len(photo_list) <= PHOTO_COUNTER:

‎tkinter_examples/button__change_button_icon_on_click/main__next_image_generator.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tkinter as tk
88

99

10-
def _on_button_click(button):
10+
def _on_button_click(button) -> None:
1111
button.config(image=get_next_image())
1212

1313

‎tkinter_examples/button__change_button_icon_on_click/main__next_image_generator__using__itertools_cycle.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def get_next_image() -> tk.PhotoImage:
2525
return next(CYCLED_IMAGES)
2626

2727

28-
def _on_button_click():
28+
def _on_button_click() -> None:
2929
panel.config(image=get_next_image())
3030

3131

‎tkinter_examples/button_entry_label.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import tkinter as tk
88

99

10-
def on_button_perevod_clicked():
10+
def on_button_perevod_clicked() -> None:
1111
your_text = text1.get()
1212
a = your_text.encode("cp1251")
1313
b = list(map(int, a))

‎tkinter_examples/center_window.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
__author__ = "ipetrash"
55

66

7-
def center_window(root, width=300, height=200):
7+
def center_window(root, width=300, height=200) -> None:
88
# get screen width and height
99
screen_width = root.winfo_screenwidth()
1010
screen_height = root.winfo_screenheight()

‎tkinter_examples/class_Example_with_Frame_Listbox.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99

1010
class Example(tk.Frame):
11-
def __init__(self, parent):
11+
def __init__(self, parent) -> None:
1212
super().__init__(parent)
1313

1414
self.parent = parent
1515
self.init_ui()
1616

17-
def init_ui(self):
17+
def init_ui(self) -> None:
1818
self.pack(fill=tk.BOTH, expand=1)
1919

2020
acts = ["Scarlett Johansson", "Rachel Weiss", "Natalie Portman", "Jessica Alba"]
@@ -31,7 +31,7 @@ def init_ui(self):
3131

3232
self.pack()
3333

34-
def on_select(self, val):
34+
def on_select(self, val) -> None:
3535
sender = val.widget
3636
idx = sender.curselection()
3737
value = sender.get(idx)

‎tkinter_examples/class_Example_with_Frame_Tab_Notebook.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99

1010
class Example(Frame):
11-
def __init__(self, parent):
11+
def __init__(self, parent) -> None:
1212
super().__init__(parent)
1313

1414
self.parent = parent
1515
self.init_ui()
1616

17-
def init_ui(self):
17+
def init_ui(self) -> None:
1818
self.notebook = ttk.Notebook(self, width=1000, height=700)
1919

2020
a_tab = ttk.Frame(self.notebook)

‎tkinter_examples/class_Example_with_Frame_Text.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99

1010
class Example(tk.Frame):
11-
def __init__(self, parent):
11+
def __init__(self, parent) -> None:
1212
super().__init__(parent)
1313

1414
self.parent = parent
1515
self.init_ui()
1616

17-
def init_ui(self):
17+
def init_ui(self) -> None:
1818
self.text = tk.Text(self, width=20, height=10)
1919
self.text.pack()
2020
self.text.insert(1.0, "Hello World!\nFoo\nBar\n\n123\n")
@@ -24,7 +24,7 @@ def init_ui(self):
2424

2525
self.pack()
2626

27-
def on_append(self):
27+
def on_append(self) -> None:
2828
self.text.insert(tk.END, "Go-go-go!\n")
2929

3030

0 commit comments

Comments
 (0)