From aa504c968aed1f7a274c0df07060cf4519afb158 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 29 May 2019 22:35:58 +0200 Subject: Integer parsing method (mainly for spinbox/entry use) --- jfr_playoff/gui/frames/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'jfr_playoff/gui') 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): -- cgit v1.2.3