From 9f03de15b88315b2ed9108dc37bdfa1b2d25170f Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Thu, 1 Aug 2024 21:10:27 -0400 Subject: [PATCH] Add a text entry using wx. --- __init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/__init__.py b/__init__.py index d2bac2c..74403d4 100755 --- a/__init__.py +++ b/__init__.py @@ -32,6 +32,7 @@ except ImportError: import math import numpy as np import time +import wx localConfig = configparser.ConfigParser() globalConfig = configparser.ConfigParser() @@ -116,6 +117,18 @@ def read_config(readGlobal = False): except: pass + +def get_input(prompt = "Enter text:", text = ""): + app = wx.App(False) + dialog = wx.TextEntryDialog(None, prompt, "Input", text) + dialog.SetValue(text) + if dialog.ShowModal() == wx.ID_OK: + userInput = dialog.GetValue() + else: + userInput = None + dialog.Destroy() + return userInput + def speak(text, interupt=True): if speechProvider == "speechd": if interupt: spd.cancel()