When trying to make my simpledialog thread safe by using mttkinter, i get an error. But when using the tkinter it works perfectly. Can anyone help please. Thanks in advance.
from mttkinter import mtTkinter as tk
from mttkinter import simpledialog
#### OR ####
from mtTkinter import simpledialog
#from tkinter import simpledialog
ui = tk.Tk()
input_str = tk.simpledialog.askstring("SimpleDialog", "Enter input", parent = ui)
#input_str = simpledialog.askstring("SimpleDialog", "Enter input", parent = ui)
ImportError: cannot import name 'simpledialog' from 'mttkinter'
I'm pretty sure that
mtTkinter
does not have thesimpledialog
module. It only imports the widgets in the baseTkinter
module:It's possible to make Tkinter thread safe without
mtTkinter
, and in fact there is no need to usemtTkinter
if you are using Python 3:If you have to use mtTkinter, try using the
Tkinter
Toplevel widget and making your own dialogs withoutsimpledialog
.