ruby - wxruby and rubymsn -
I am currently playing with wxRuby and RubyMSN to learn the programs of desktop programs. I know that instead of crushing Notepad etc. it is a difficult task, but I need a bigger job than Notepad.
Now I manage to use them by myself, but I can not do them to work together. The problem is loop.
wants to have an endless loop like RubyMsN
while the correct sleeping end of
or the main of the GUI Loop or something
I currently place this code as a loop
TheApp.new.main_loop () while the correct sleeping end
I have my window, and main_loop is doing something but I can not enter, it seems that I do not have any loop, only get a debug line. But as soon as I Close the window and allow the endless loop, it does the job, it works like a magic
Anyone?
Worked for me to try it: wxruby copy from minimum
sample copy Create and modify minimal.rb
so that you start your MSN thread before the wx main loop:
requires 'msn / msn' conn = MSNConnection.new ("rubybot@channelwood.org", "secretpassword123") conn.start # Wx :: app is a container class for any wxruby app. # To start the application, either define the subclass of the Wx :: app, create an example, call # and its main_overup method, or just call the Wx :: App.run class # method, just like That's shown here. Wx :: App.run do self.app_name = 'minimum' frame = minimum frame. New ("minimum wxRuby app") frame. Show End
You do not need while the true {sleep 1} is not required.
Loop; This is to stop the program from halting so that your MSN thread is running. The Wx main loop caters to the same purpose.
Comments
Post a Comment