Ruby Language Getting started with Ruby Language Hello World with tk

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Tk is the standard graphical user interface (GUI) for Ruby. It provides a cross-platform GUI for Ruby programs.

Example code:

require "tk"
TkRoot.new{ title "Hello World!" }
Tk.mainloop

The result:

Result of Hello World with tk

Step by Step explanation:

require "tk"

Load the tk package.

TkRoot.new{ title "Hello World!" }

Define a widget with the title Hello World

Tk.mainloop

Start the main loop and display the widget.



Got any Ruby Language Question?