You can do it by doing the following, mind you none of this code has been "tested", so you will need to tweak a few things, but these are the basics of what you need to do, to ensure that you capture mouse down, and mouse up events, as well as motion events for when the user moves the mouse over the drawing area.

def drawingarea1__button_press_event(*args)
  @capture = true
  if args[1].button == 1  # Left Button down
    @button = :left
  elsif args[1].button == 2 # Middle Button down
    @button = :middle
  elsif args[1].button == 3 # Right Button down
    @button = :right
  @start_x = args[1].x
  @start_y = args[1].y

def drawingarea1__button_release_event(*args)
  @capture = false
  @button = nil
  @end_x = args[1].x
  @end_y = args[1].y

def drawingarea1__motion_notify_event(*args)
  x, y = @builder["drawingarea1"].pointer

  if @capture
    # Do drawing logic here



On Sat, Dec 15, 2012 at 4:38 PM, Patrik K. <> wrote:
Hi there

I put a drawing area into my GUI class:
window1 / vbox1 / drawingarea1

Can someone tell me how to draw lines circles and boxes on it by mouse?


Posted via

LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
ruby-gnome2-devel-en mailing list

Mario Steele
Fleet Captain
CO - Geo 99
CO - USS T'hy'la
XO - Diplomatic Corps - Second Life