class DrawingareaDemo
# Copyright © 2016 Ruby-GNOME2 Project Team # This program is licenced under the same licence as Ruby-GNOME2. #
Drawing Area¶ ↑
GtkDrawingArea is a blank area where you can draw custom displays of various kinds. This demo has two drawing areas. The checkerboard area shows how you can just draw something; all you have to do is write a signal handler for "draw", as shown here. The "scribble" area is a bit more advanced, and shows how to handle events such as button presses and mouse motion. Click the mouse and drag in the scribble area to draw squiggles. Resize the window to clear the area.
Public Class Methods
new(main_window)
click to toggle source
# File gtk3/sample/gtk-demo/drawingarea.rb, line 20 def initialize(main_window) @window = Gtk::Window.new(:toplevel) @window.screen = main_window.screen @window.title = "Drawing Area" initialize_vbox create_the_checkerboard_area create_the_scribble_area end
Public Instance Methods
run()
click to toggle source
# File gtk3/sample/gtk-demo/drawingarea.rb, line 30 def run if !@window.visible? @window.show_all else @window.destroy end @window end