Created
September 17, 2022 01:01
-
-
Save veer66/f4c108257de5fb72636368f3c0831812 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "gtk3" | |
app = Gtk::Application.new "rocks.veer66.Halo", :flags_none | |
app.signal_connect :activate do |app| | |
window = Gtk::ApplicationWindow.new(app) | |
window.set_title "Halo" | |
vbox = Gtk::Box.new(Gtk::Orientation::VERTICAL) | |
t1 = Gtk::TextView.new | |
sw = Gtk::ScrolledWindow.new | |
sw.set_policy(:automatic, :automatic) | |
sw.add(t1) | |
vbox.pack_start(sw, expand: true, fill: true, padding: 2) | |
b1 = Gtk::Button.new label: "B1 ....", expand: false, fill: false, padding: 2 | |
b1.signal_connect "clicked" do |_| | |
t1.buffer.insert_at_cursor(%x{ls}) | |
t1.buffer.insert_at_cursor("\n\n") | |
end | |
vbox.pack_start b1 | |
b2 = Gtk::Button.new label: "B2 ...", expand: false, fill: false, padding: 2 | |
vbox.pack_start b2 | |
b3 = Gtk::Button.new label: "B3 ...", expand: false, fill: false, padding: 2 | |
vbox.pack_start b3 | |
b4 = Gtk::Button.new label: "B4 ...", expand: false, fill: false, padding: 2 | |
vbox.pack_start b4 | |
b5 = Gtk::Button.new label: "Quit", expand: false, fill: false, padding: 2 | |
b5.signal_connect "clicked" do |_| | |
window.destroy | |
end | |
vbox.pack_start b5 | |
window.add(vbox) | |
window.show_all | |
end | |
app.run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment