Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6907145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:23:56+00:00 2026-05-27T08:23:56+00:00

I’m using Ubuntu 10.04 and I’m trying to run a WxRuby example which I

  • 0

I’m using Ubuntu 10.04 and I’m trying to run a WxRuby example which I copy-pasted from this site WxRubyWiki. I’ve been looking for help over the net but I couldn’t find anything similar…

I’m getting this error…

Gtk:ERROR:/build/buildd/gtk+2.0-2.20.1/gtk/gtkwindow.c:6789:IA__gtk_window_present_with_time: assertion failed: (widget->window != NULL)
Aborted

These are the versions I’m using…

ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
gem list
...
wxruby (2.0.1 x86-linux)
...

And this is the code I’m trying to run…

require 'rubygems' if RUBY_VERSION < '1.9'
require 'wx'

class EventFrame < Wx::Frame
    def initialize()
        super(nil, -1, "Event Frame")
        @idleCounter = 0
        evt_close {|event| on_close(event)}
        evt_idle {|event| on_idle(event)}
        evt_size {|event| on_size(event)}
        evt_key_down {|event| on_key(event)}
        evt_left_down {|event| on_left_down(event)}
        # You can still process these events, you just need to define a separate callback for middle_down and right_down
        # to process them as separate events
        evt_middle_down {|event| on_middle_down(event)}
        evt_right_down {|event| on_right_down(event)}

        button = Wx::Button.new(self, -1, "Push me")
        evt_button(button.get_id()) {|event| on_button(event)}

        show()
    end

    def message(text, title)
        m = Wx::MessageDialog.new(self, text, title, Wx::OK | Wx::ICON_INFORMATION)
        m.show_modal()
    end

    def on_close(event)
        message("This frame will be closed after you push ok", "Close event")
        #close(true) - Don't call this - it will call on_close again, and your application will be caught in an infinite loop
        # Either call event.skip() to allow the Frame to close, or call destroy(), as follows
        destroy()
    end

    def on_idle(event)
        @idleCounter += 1
        if @idleCounter > 15 # Without the counter to slow this down, Idle events would be firing every second
            message("The system is idle right now", "Idle event")
            @idleCounter = 0
        end
        event.request_more() # You must include this, otherwise the Idle event won't occur again
    end

    def on_size(event)
        size = event.get_size()
        x = size.x
        y = size.y
        message("X = " + x.to_s + ", Y = " + y.to_s, "Size event")
    end

    def on_key(event)
        message("Key pressed", "Key Event")
    end

    def on_left_down(event)
        button = ""
        if event.left_down()
            button = "Left"
        end
        message(button + " button was clicked", "Mouse event")
    end

    def on_middle_down(event)
        # This method hasn't been implemented yet...
        #if event.middle_down()
           #button = "Middle"
        #end
        message("Middle button was clicked", "Mouse event")
    end

    def on_right_down(event)
        # This method hasn't been implemented yet...
        #if event.right_down()
            #button = "Right"
        #end
        message("Right button was clicked", "Mouse event")
    end

    def on_button(event)
        message("Button was clicked", "Button event")
    end
end

class MyApp < Wx::App
    def on_init
        EventFrame.new()
    end
end

MyApp.new.main_loop

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:23:57+00:00Added an answer on May 27, 2026 at 8:23 am

    this fixed and works in ubuntu 11.10 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.