Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?


Failed to load latest commit information.
Latest commit message
Commit time
July 4, 2021 03:22
August 17, 2022 16:17
August 17, 2022 16:17
August 17, 2022 16:17
May 7, 2021 11:38
July 4, 2021 03:22
July 4, 2021 03:22
August 17, 2022 16:17


wNim is Nim's Windows GUI Framework, based on winim. Layout DSL is powered by Yuriy Glukhov's Kiwi constraint solving library.

Code Examples

Basic code structure:

import wNim

let app = App()
let frame = Frame(title="Hello World", size=(400, 300))

Event handler:

button.wEvent_Button do ():

frame.wIdExit do ():

frame.wEvent_Size do ():

Layout DSL:

    top = + 10
    left = panel.left + 10
    right + 10 = panel.right
    bottom + 10 = panel.bottom


panel.autolayout """

Getter and Setter:

let frame = Frame()

# wxWidgets/wxPython style
frame.setLabel("Hello World")
echo frame.getLabel()

# nim style
frame.label = "Hello World"
echo frame.label




With git on windows:

nimble install wNim

Without git:

1. Download and unzip this moudle (by click "Code" button).
2. Start a console, change current dir to the folder which include "wNim.nimble" file.
   (for example: C:\wNim-master\wNim-master>)
3. Run "nimble install"


The easiest way to use wNim is to import the whole package.

import wNim

However, the modules of wNim can be aslo imported one by one to speed up compilation time.

import wNim/[wApp, wFrame]

There are some simple rules:

1. For every classes in wNim, there is a corresponding module.
   For example: wFrame, wIcon, wMenu, etc.
2. wApp module must be imported in every wNim program.
3. Symbols in wColors and wKeyCodes modules are imported automatically with wApp module.
4. All event classes in wNim share the same constructor: Event(), so all subclasses module
   of wEvent will be imported with wEvent module automatically.
5. wMacros, wUtils, and wTypes modules are three special module in wNim.
   See their document for more information.


To compile the examples, try following command:

nim c -d:release -d:strip --opt:size --app:gui demo.nim

For Windows XP compatibility, add:


To compile by Tiny C Compiler, or want to add some resource files, take a look at

Q & A

Q: Why I start this project?

In the first, I just wanted to write some code to test and prove my winim library. I wrote some event handler, some GUI control class, more and more...Finally, it become a whole GUI framework now.

Q: Why the class and api name look so like wxWidgets?

English is not my mother tongue, I often have no idea how to name an object or a function. So I borrow wxWidgets' names to develop my own framework.

Q: Why not add linux or macOS support?

I start from winim. It is just a Windows API module.

Q: How is wNim compare to nimx, libui, NiGui etc?

They are all good GUI librarys. I think wNim is easier to use and produce smaller exe file. However, it only support Windows system.



Read license.txt for more details.

Copyright (c) 2017-2021 Kai-Hung Chen, Ward. All rights reserved.