using Gtk; class Program { static void Main(string[] args) { Gtk.Application.Init(); var window = new Window("Gtk Label Example") { DefaultWidth = 250, DefaultHeight = 200 }; var label = new Label("Hello, World!"); window.Add(label); window.ShowAll(); Gtk.Application.Run(); } }
using Gtk; public partial class MainWindow : Gtk.Window { public MainWindow() : base(Gtk.WindowType.Toplevel) { SetDefaultSize(250, 200); var label = new Label("Gtk label example!"); Add(label); } }This code sets up a new Gtk window with a single label widget that displays the text "Gtk label example!". The package library for Gtk# is included with Mono or .NET Core on Linux, macOS, and Windows. You can use the nuget package manager to get it if you're using it from Visual Studio.