more on type hinting, remove unecessary function comments

This commit is contained in:
Huy Pham 2020-01-13 12:03:13 -08:00
parent 7bbd6aa353
commit eb5f2c5648
34 changed files with 169 additions and 326 deletions

View file

@ -1,6 +1,7 @@
import logging
import tkinter as tk
from functools import partial
from pathlib import PosixPath
from tkinter import filedialog, font, ttk
from core.api.grpc import core_pb2
@ -19,7 +20,7 @@ INT_TYPES = {
}
def file_button_click(value, parent):
def file_button_click(value: tk.StringVar, parent: tk.Widget):
file_path = filedialog.askopenfilename(title="Select File", parent=parent)
if file_path:
value.set(file_path)
@ -49,13 +50,13 @@ class FrameScroll(ttk.Frame):
self.frame.bind("<Configure>", self._configure_frame)
self.canvas.bind("<Configure>", self._configure_canvas)
def _configure_frame(self, event):
def _configure_frame(self, event: tk.Event):
req_width = self.frame.winfo_reqwidth()
if req_width != self.canvas.winfo_reqwidth():
self.canvas.configure(width=req_width)
self.canvas.configure(scrollregion=self.canvas.bbox("all"))
def _configure_canvas(self, event):
def _configure_canvas(self, event: tk.Event):
self.canvas.itemconfig(self.frame_id, width=event.width)
def clear(self):
@ -238,7 +239,7 @@ class Spinbox(ttk.Entry):
self.tk.call(self._w, "set", value)
def image_chooser(parent, path):
def image_chooser(parent: tk.Widget, path: PosixPath):
return filedialog.askopenfilename(
parent=parent,
initialdir=str(path),