FreeCAD/fix_unittestgui_tkinter_py3.patch

30 lines
905 B
Diff
Raw Normal View History

diff --git a/src/Mod/Test/unittestgui.py b/src/Mod/Test/unittestgui.py
index 6e93079b8..e6125a694 100755
--- a/src/Mod/Test/unittestgui.py
+++ b/src/Mod/Test/unittestgui.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
"""
GUI framework and application for use with Python unit testing framework.
Execute tests written using the framework provided by the 'unittest' module.
@@ -29,12 +29,15 @@ __version__ = "$Revision: 2.0 $"[11:-2]
import unittest
import sys
-import Tkinter
-import tkMessageBox
+if sys.version_info.major >= 3:
+ import tkinter as tk
+ from tkinter import messagebox as tkMessageBox
+else:
+ import Tkinter as tk
+ import tkMessageBox
import traceback
import string
-tk = Tkinter # Alternative to the messy 'from Tkinter import *' often seen
##############################################################################