GTK::Simple

Simple GTK 3 binding using NativeCall

image https://github.com/finanalyst/GTK-Simple/actions/workflows/test.yaml/badge.svg not found

GTK::Simple

GTK::Simple is a set of simple GTK 3 bindings using NativeCall. Only some GTK widgets are currently implemented. However, these are enough to create a reasonable interactive GUI for an idiomatic Raku program. The GTK Widgets in this distribution include the following:

WidgetDescription
ButtonA simple button with a label and a callback
ComboBoxTextA simple combo box
EntryAllows for text to be provided by the user
FileChooserButtonA button that opens a file chooser dialog
FrameA bin with a decorative frame and optional label
GridA table-like container for widgets for window design
LabelAdds a line of text
LevelBarA bar that can used as a level indicator
LinkButtonCreate buttons bound to a URL
MarkUpLabelAdds text with GTK mark up (e.g. color and font manipulation)
MenuA simple menu with a menu item label
MenuBarA simple menu bar that contain one or more menus
MenuItemA simple menu item that can have a sub menu
MenuToolButtonA menu tool button with a label or an icon
PlacesSidebarSidebar that displays frequently-used places in the file system
ScaleAllows for a number to be provided by the user
ScrolledWindowContainer for widgets needing scrolling, eg., multiline texts
RadioButtonA choice from multiple check buttons
SpinnerShowing that something is happening
TextViewAdds multiple lines of text
ToolbarA tool bar that can contain one or more menu tool buttons
VBox, HBoxWidget containers which enable window layout design

Example

use GTK::Simple;
use GTK::Simple::App;

my $app = GTK::Simple::App.new( title => "Hello GTK!" );

$app.set-content(
    GTK::Simple::VBox.new(
        my $button = GTK::Simple::Button.new(label => "Hello World!"),
        my $second = GTK::Simple::Button.new(label => "Goodbye!")
    )
);

$app.border-width = 20;
$second.sensitive = False;
$button.clicked.tap({ .sensitive = False; $second.sensitive = True });
$second.clicked.tap({ $app.exit; });
$app.run;

The first four examples were written as mini tutorials to show how the system works:

For more examples, please see the examples/ folder.

Limitations

The full functionality of GTK 3 is not available in this module.

Prerequisites

This module requires the GTK3 library to be installed. Please follow the instructions below based on your platform:

Debian Linux

sudo apt-get install libgtk-3-dev

Mac OS X

brew update
brew install gtk+3

Windows

The GTK team describes how to do this for Windows at Setting up GTK for Window

Installation and sanity tests

Use the zef package manager

$ zef install GTK::Simple

Author

Jonathan Worthington, jnthn on #raku, https://github.com/jnthn/

Contributors

The Raku team

License

The Artistic License 2.0

GTK::Simple v0.2.1

Simple GTK 3 binding using NativeCall

Authors

  • Jonathan Worthington
  • Moritz Lenz
  • Timo Paulssen
  • Ahmad M. Zawawi
  • Jonathan Stowe
  • ab5tract
  • momozor
  • Zoffix Znet
  • Nick Logan
  • finanalyst aka Richard Hainsworth

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • GTK::Simple
  • GTK::Simple::ActionBar
  • GTK::Simple::App
  • GTK::Simple::Box
  • GTK::Simple::Button
  • GTK::Simple::Calendar
  • GTK::Simple::CheckButton
  • GTK::Simple::ComboBoxText
  • GTK::Simple::Common
  • GTK::Simple::ConnectionHandler
  • GTK::Simple::Container
  • GTK::Simple::DrawingArea
  • GTK::Simple::Entry
  • GTK::Simple::FileChooserButton
  • GTK::Simple::Frame
  • GTK::Simple::GDK
  • GTK::Simple::Grid
  • GTK::Simple::HBox
  • GTK::Simple::Label
  • GTK::Simple::LevelBar
  • GTK::Simple::LinkButton
  • GTK::Simple::MarkUpLabel
  • GTK::Simple::Menu
  • GTK::Simple::MenuBar
  • GTK::Simple::MenuItem
  • GTK::Simple::MenuToolButton
  • GTK::Simple::NativeLib
  • GTK::Simple::PlacesSidebar
  • GTK::Simple::ProgressBar
  • GTK::Simple::PropertyFacade
  • GTK::Simple::RadioButton
  • GTK::Simple::Raw
  • GTK::Simple::Scale
  • GTK::Simple::Scheduler
  • GTK::Simple::ScrolledWindow
  • GTK::Simple::Separator
  • GTK::Simple::Spinner
  • GTK::Simple::StatusBar
  • GTK::Simple::Switch
  • GTK::Simple::TextView
  • GTK::Simple::ToggleButton
  • GTK::Simple::Toolbar
  • GTK::Simple::VBox
  • GTK::Simple::Widget
  • GTK::Simple::Window

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.