On further looking i have found an example code room_data.py that generates an inputbox.
You can use tkinter library to do this. The code example is as below:
import tkinter as tk
def generate_window(project):
class Window(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.project = project
self.project_folder = project.path
self.text_entry = ''
self.master = master
self.init_window()
# Creation of init_window
def init_window(self):
# changing the title of our master widget
self.master.title("Input text")
self.master.columnconfigure(0, weight=1)
self.master.rowconfigure(0, weight=1)
self.master.grid()
print(self.project_folder)
tk.Label(self, text=' ').grid(row=7, sticky=tk.W)
tk.Label(self, text='Text will be returned in the console').grid(row=8, sticky=tk.W)
tk.Label(self, text='Enter the text below:').grid(row=9, sticky=tk.W)
self.text_entry_box = tk.Entry(self)
self.text_entry_box.insert(0, self.text_entry)
self.text_entry_box.grid(row=10, sticky='ew')
tk.Label(self, text=' ').grid(row=11, sticky=tk.W)
# creating a button instance
tk.Button(self, text="Return text", command=self.return_text).grid(row=12, sticky=tk.W)
self.columnconfigure(0, weight=1)
self.grid(row=0, column=0, sticky='nsew')
def return_text(self):
self.text_entry = self.text_entry_box.get()
print('Text entered = ' + self.text_entry)
root = tk.Tk()
app = Window(root)
root.mainloop()
if __name__ == '__main__':
project = iesve.VEProject.get_current_project()
generate_window(project)
I have been looking into this and cannot find anything useful. There is an option to import win32gui but I can't find a away to create an input box for that.
I tried using readline and that also failed :(. Try suggesting this a a feature to ies ;)
I found a way to do it using the tkinter libary (look for room_data.py example script) but my answer post here hasn't appeared yet.
I'll keep an eye out for your answer. Thanks for replying back to this though. This post was a while ago and we've done quite a bit of Python development since this question.. We actually removed the "project name" from our script, as it seemed silly to use Python to automate something that requires a manual user input. However, if you did want to do something like this, I'd recommend writing the entered value to a file (temp.txt or something) so that you can read it as the default value in the tkinter dialogue.. I haven't used win32gui but tkinter would certainly do what was needed here.