Skip to content

Commit

Permalink
make tkinter import optional
Browse files Browse the repository at this point in the history
only import tkinter library if it is needed
  • Loading branch information
drunsinn committed Dec 14, 2020
1 parent b75b4ca commit 38b570e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions type2nc/type2nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import platform
import datetime
import string
import tkinter as tk
import tkinter.filedialog as tkfd
import tkinter.simpledialog as tksd
import tkinter.messagebox as tkmb
import argparse
import numpy as np
from scipy.special import binom
Expand Down Expand Up @@ -437,6 +433,10 @@ def generate_demo_file(self, use_cycle_def=False):
file_types = [('Font', '*.ttf *.tte *.ttc *.otf *.dfont *.pfb')]

if args.input is None:
import tkinter as tk
import tkinter.filedialog as tkfd
import tkinter.simpledialog as tksd
import tkinter.messagebox as tkmb
root = tk.Tk()
root.overrideredirect(1)
root.withdraw()
Expand Down

0 comments on commit 38b570e

Please sign in to comment.