Skip to: Site menu | Main content

Hello World Recipes Print

How many ways can you say Hello World?

This example shows console, WinForms and Gtk versions of "Hello, world!".

Console

print("Hello, world!")

WinForms

import System.Windows.Forms

f = Form(Text: "Hello, boo!")
f.Controls.Add(Button(Text: "Click Me!", Dock: DockStyle.Fill))

Application.Run(f)

Gtk#

import Gtk

Application.Init()

window = Window("Hello, boo!",
                DefaultWidth:  200,
                DefaultHeight: 150)

# The application should exit after the window is closed
window.DeleteEvent += def():
    Application.Quit ()

window.Add(Button("Click Me!"))
window.ShowAll()
Application.Run()