I am using a simpledialog box to pop up and enter information within a function. I have to first click on the box before typing my input, which is too slow for what I want to use it for. Is it possible to run the function, have the simpledialog box pop up and type immediately without clicking the box?
Please find the relevant code lines I'm using below:
%matplotlib notebook
import tkinter as tk
from tkinter import simpledialog
d1 = []
dots = []
fig,ax = plt.subplots(figsize=(10,20))
ROOT = tk.Tk()
ROOT.withdraw()
def func1(event):
if event.inaxes:
dots.append((event.xdata, event.ydata))
if len(dots) == 2:
ax.plot([dots[0][0], dots[1][0]],
[dots[0][1], dots[1][1]], 'yo-')
amount = simpledialog.askstring(title="Amount", prompt="Type Number:")
d1.append([dots[0], dots[1], amount])
dots[:] = []
fig.canvas.draw()
Thanks in advance.