-
Notifications
You must be signed in to change notification settings - Fork 0
GUI & Event Handlers
Nova features a built-in system for creating GUI's. Instead of just running in a console, you can create windows with labels, buttons, and interactive elements.
The ui_window block is the foundation of any Nova GUI app. It defines the title and dimensions of the window. Although you MUST use, use novaui to make sure that the ui library is used. In Python, it is similar to doing, import tkinter
- Syntax:
ui_window("Window Title", width, height) {
// Any GUI or window elements go here
}
popup() Creates a standard popup alert box with a message for the user.
- Example:
popup("This is an alert!")
Inside the ui_window block, you can add various controls:
Labels Labels are used to display static text within a window.
- Syntax:
label("Text", x, y, width, height). You can also useset_labelto change a label, and also usenamed_labelto refer to a label by a string.
Buttons Buttons allow users to interact with your application.
- Syntax:
button("Button Text", x, y) { . . . }You can also useon_button()to detect when a button was clicked.
Button Grids
You can add a grid of buttons to shorten code, using the button_grid piece of code. Example:
button_grid(VARIABLE, VARIABLE, VARIABLE, Size, Size, "")
Text Boxes
You can add text boxes to add inputs without using buttons using the txtbox() {} line. Example:
ui_window("Test", y size, x size) {
txtbox("Input your name", "userName", y coords, x coords, width) {
label("You entered: " + userName)
}
}
You can also customize the appearance of your windows.
icon() Sets the icon for the application window. Icons must be .ico's for it to work, if not, Nova will revert to a default icon rather than using your one. Renaming the file from something like Icon.png to Icon.ico will NOT work, you must use a proper tool for this.
- Example:
icon("App5/Icon.ico")
The colors() {} line can be used to edit the colours of a window (colours() {} is also valid). There are three presets for you to try out, Nova (Black + Purple), Dark, and Light. Example using preset:
colors(Nova) {}
You can also overwrite the preset colours by doing:
colors(Nova) {
txt = HEX CODE HERE
bg = HEX CODE HERE
accent = HEX CODE HERE
}
You can also use txt, bg, and accent without any preset. You can also add colours into the actual ui_window line of code at the end of the size and anything else, you just add hex codes and it goes in this order: main, accent, text. Note you can currently only use hex codes for customization.
Join our discord server for any support or questions that you need answered!
Link: