class Window(
name : str = "Title of the window",
text : str = "Hello, world!",
width : int = 40,
fields : list = None,
buttons : list = [{"text":"OK", "type": "button"}, {"text":"Cancel", "type": "button"}],
inputvalues: dict = {}
tabindex : int = 0,
)
💡 Usage :
win = Window(name="A window",text="Hello!") # Some config
win.mainloop() # Start the loop
name ( String )
Sets the window name and the title. Default is Title of the window.
text ( String )
The window's content, divided by new lines. Default is Hello, world!.
width ( Integer )
The window's width in columns. The default width is 40.
fields ( List )
Put Fields in this list.
buttons ( List )
Put Buttons in this list. Defaults are OK and Cancel
inputvalues ( Dictionnary )
Sets the default field values (used by system)
tabindex ( Integer )
Sets the default tab index (used by system)
destroy()
Destroys the window, by removing all keybindings.
mainloop()
Starts the window's main loop, that activates keybinds.
inputvalues ( Dictionnary )
Get the input's value by querying by their name.
💡 Example :
>>> win = Window(fields={"name":"field", "type":"field"} ...)
>>> win.mainloop() # Start the loop
>>> print(win.inputvalues)
{"field":""}
ValueError: To much text! Text must be less than X characters (line X)
You get this error when the lengh a line of your text is bigger than the window's width.
💡 Example :
>>> win = Window(text="Loooooooooooooong text",width=10) # 17Â >Â 10
>>> win.mainloop() # Start the loop
ValueError: To much text! Text must be less than 10 characters (line 1)