First time here? Check out the Help page!
1 | initial version |
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)