An extremely simple GUI library for Nim with English-like syntax. Under 400 lines of code!
✅ Super Simple Syntax - English-like commands
✅ Windows Native - Uses Windows API directly
✅ Under 400 LOC - Minimal and lightweight
✅ Real GUI Controls - Clickable buttons, text inputs
✅ Event Handling - Button clicks and callbacks
- Clone or download this library
- Install dependencies:
nimble install winimimport easygui # Create a window discard createWindow("My App", 400, 300) # Add widgets addLabel("Hello World!") addButton("Click Me") do: showMessage("Button clicked!") addInput("Enter name:", "John Doe") # Show the window showWindow()createWindow(title, width, height)- Creates a new windowshowWindow()- Shows the window and starts message loopcloseWindow()- Closes the current window
addLabel(text)- Adds a text labeladdButton(text, onClick)- Adds a clickable buttonaddInput(placeholder, defaultValue)- Adds a text input field
addSpace(pixels)- Adds vertical spacingaddRow()- Starts a new row (adds small space)addColumn()- Placeholder for future column layout
showMessage(message)- Shows a message (console for now)
import easygui discard createWindow("Hello", 300, 200) addLabel("Hello World!") showWindow()import easygui discard createWindow("Calculator", 300, 400) addLabel("Simple Calculator") addButton("1") do: showMessage("1 clicked") addButton("2") do: showMessage("2 clicked") addButton("+") do: showMessage("Plus clicked") showWindow()import easygui discard createWindow("Form", 400, 300) addLabel("User Registration") addLabel("Name:") addInput("Enter name", "") addLabel("Email:") addInput("Enter email", "") addButton("Submit") do: showMessage("Form submitted!") showWindow()easygui/ ├── src/ │ ├── easygui.nim # Main library (exports everything) │ ├── window.nim # Window management & Windows API │ ├── widgets.nim # Widget functions (label, button, input) │ └── events.nim # Event handling & callbacks ├── examples/ │ ├── hello_world.nim # Basic example │ ├── calculator.nim # Button example │ └── form.nim # Input example ├── tests/ │ └── test_basic.nim # Basic functionality tests ├── easygui.nimble # Package configuration └── README.md # This file - Windows (currently Windows-only)
- Nim 1.6.0 or higher
- winim package (
nimble install winim)
- English-like syntax :
addButton("Save")notnewButton().setText("Save") - Implicit context : Widgets automatically added to current window
- Callback style : Use
do:blocks for event handling - Sensible defaults : Minimize required parameters
- Progressive disclosure : Start simple, add complexity as needed
- Total Lines : ~350 lines of code
- Files : 4 source files + examples
- Dependencies : Only
winimfor Windows API - Hello World : 5 lines of code
MIT License
This is a minimal library by design. For feature requests, please consider if they align with the "extremely simple" goal.