diff options
author | emkael <emkael@tlen.pl> | 2019-05-29 22:35:58 +0200 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2019-05-29 22:35:58 +0200 |
commit | aa504c968aed1f7a274c0df07060cf4519afb158 (patch) | |
tree | 062b0321bc986a755c330711039f06c62e29ff2d | |
parent | 6fcf4be43234b63f86735ea7bbbf077c9ed519d3 (diff) |
Integer parsing method (mainly for spinbox/entry use)
-rw-r--r-- | jfr_playoff/gui/frames/__init__.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/jfr_playoff/gui/frames/__init__.py b/jfr_playoff/gui/frames/__init__.py index c046e53..a4cc361 100644 --- a/jfr_playoff/gui/frames/__init__.py +++ b/jfr_playoff/gui/frames/__init__.py @@ -3,6 +3,12 @@ import tkinter as tk from tkinter import ttk +def getIntVal(widget, default=0): + try: + return int(widget.get().strip()) + except ValueError: + return default + class WidgetRepeater(tk.Frame): def __init__(self, master, widgetClass, headers=None, *args, **kwargs): if not issubclass(widgetClass, RepeatableFrame): |