PEP 8 cleanup
This commit is contained in:
parent
c2775d2c25
commit
16f1eb6b8e
@ -3,22 +3,24 @@ from tkinter import ttk
|
||||
|
||||
status = 1 # 1 - neue Eingabe, 2 - Eingabe verarbeitet
|
||||
|
||||
def switch_status(newS: int = None):
|
||||
|
||||
def switch_status(new_status: int = None):
|
||||
""" Verändert den globalen Status
|
||||
|
||||
:param newS: neuer Statuswert
|
||||
:param new_status: neuer Statuswert
|
||||
:return: None
|
||||
"""
|
||||
global status
|
||||
if not newS:
|
||||
if not new_status:
|
||||
if status == 1:
|
||||
status = 2
|
||||
else:
|
||||
status = 1
|
||||
else:
|
||||
status = newS
|
||||
status = new_status
|
||||
update_statusbar()
|
||||
|
||||
|
||||
def update_statusbar():
|
||||
""" Passt die Farbe der Statuszeile an den Status an.
|
||||
|
||||
@ -32,6 +34,7 @@ def update_statusbar():
|
||||
else:
|
||||
frame_statusbar['style'] = 'bFrame.TFrame'
|
||||
|
||||
|
||||
def calculate(*args):
|
||||
""" Berechnet aus der eingegebenen Länge in feet die Länge in Metern.
|
||||
|
||||
@ -50,6 +53,7 @@ def calculate(*args):
|
||||
pass
|
||||
return True
|
||||
|
||||
|
||||
def check_entry(what: str = ""):
|
||||
""" Validiert, ob Eingabe leer oder eine Fließkommazahl ist.
|
||||
|
||||
@ -70,6 +74,7 @@ def check_entry(what : str = ""):
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
# Hauptfenster
|
||||
root = Tk()
|
||||
root.title("Feet to Meters")
|
||||
@ -87,7 +92,7 @@ feet = StringVar()
|
||||
feet_entry = ttk.Entry(mainframe, width=7, textvariable=feet,
|
||||
validatecommand=(check_entry_wrapper, '%P'),
|
||||
validate='key')
|
||||
feet_entry.grid(column = 2, row = 1, sticky = (W, E))
|
||||
feet_entry.grid(column=2, row=1, sticky=W + E)
|
||||
|
||||
# Einheit-Label für Eingabefeld der Länge in feet
|
||||
ttk.Label(mainframe, text="feet").grid(column=3, row=1, sticky=W)
|
||||
|
Loading…
Reference in New Issue
Block a user