[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

open web page from Ruby Tk app

e deleflie

5/10/2008 4:01:00 AM

All,

I'm trying to avoid using TkHTML (too many dependencies in a
cross-platform app).

I just want to click on a "link" (maybe a TkLabel with text underlined
and in blue) ... and open a URL in a web page.

- Does anyone have some sample code for opening a web page in the OS's
default browser?
- also, does anyone have any sample code on executing a proc on mouse
down in a TKlabel?

any help is appreciated.

Etienne

3 Answers

7stud --

5/10/2008 7:42:00 AM

0

e deleflie wrote:
>
> - also, does anyone have any sample code on executing a proc on mouse
> down in a TKlabel?
>


require 'tk'

def on_button_press(e)
widget = e.widget
xcoord = e.x
ycoord = e.y

puts "button pressed, x:#{xcoord}, y:#{ycoord}"
end



root = TkRoot.new {
title 'Label Test'
geometry "600x400+200+50"
}

label = TkLabel.new(root) do
text "click me"
pack
end

label.bind('ButtonPress-1', lambda {|e| on_button_press(e)})
label.bind("ButtonRelease-1", proc{puts "button released"})

Tk.mainloop

--
Posted via http://www.ruby-....

Barry OGrady

2/28/2013 4:51:00 AM

0

On Wed, 27 Feb 2013 19:56:44 -0800 (PST), gladys swager
<gswager@gmail.com> wrote:

>Oh my God, you're an idiot.

Who are you calling an idiot?

>One can measure the origin of a gene through the time
>it takes to propagate through a population.
>In this manner you can date back to the appearance of the gene.

Where did you learn that?

-=-=-=-=-=-=-=
An interesting thing happens when we line up our
fossil finds according to how old they are.
We can see how life changed through time.

Barry OGrady

2/28/2013 7:26:00 AM

0

On Wed, 27 Feb 2013 22:32:50 -0800 (PST), garthdvoigt@aol.com wrote:

>I'm calling all creationists who deny the evidence and offer up lies or factual errors -especially when the proof of evolutionism is ignored. I call people who have no science background and refuse to educate themselves yet attempt to speak with authority idiots

I'm on your side by I do wish you would quote so we know
to what you are replying and format your lines to a reasonable
length.

-=-=-=-=-=-=-=
An interesting thing happens when we line up our
fossil finds according to how old they are.
We can see how life changed through time.