471,354 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

wxpython: handling URL event

8
I have set an url property to a text in a RichTextCtrl :
Expand|Select|Wrap|Line Numbers
  1.        self.obj.BeginURL('file:\\\%s'% str(i[0])) 
  2.        self.obj.WriteText( '%s/%s/%s\n' % (_splittata[-3], _splittata[-2], _splittata[-1]) )
  3.        self.obj.EndURL()
now the text il linked but when I click on it nothing happens: I think I need to Bind an event to the RichTextCtrl but what event? I don't know what is the appropriate event!
Please help me!
Jul 5 '07 #1
5 1942
bartonc
6,596 Expert 4TB
I have set an url property to a text in a RichTextCtrl :
Expand|Select|Wrap|Line Numbers
  1.        self.obj.BeginURL('file:\\\%s'% str(i[0])) 
  2.        self.obj.WriteText( '%s/%s/%s\n' % (_splittata[-3], _splittata[-2], _splittata[-1]) )
  3.        self.obj.EndURL()
now the text il linked but when I click on it nothing happens: I think I need to Bind an event to the RichTextCtrl but what event? I don't know what is the appropriate event!
Please help me!
You want to bind to the wx.EVT_TEXT_URL. Something like:
Expand|Select|Wrap|Line Numbers
  1.         self.textCtrl1.Bind(wx.EVT_TEXT_URL, self.OnTextCtrl1TextUrl, id=wxID_PANEL1TEXTCTRL1)
  2.  
Jul 5 '07 #2
nisyna
8
I love you ;.) !!!!! Thank you so much...it works!

another question:
i've done that:
Expand|Select|Wrap|Line Numbers
  1. self.textbox.Bind(wx.EVT_TEXT_URL,self.GoToURL)
  2.  
then:
Expand|Select|Wrap|Line Numbers
  1. def GoToURL(self,event):
  2.         print event.
  3.  
how to get the URL from the event? I think it's something like event.URL()???
thanks
Jul 5 '07 #3
bartonc
6,596 Expert 4TB
I love you ;.) !!!!! Thank you so much...it works!

another question:
i've done that:
Expand|Select|Wrap|Line Numbers
  1. self.textbox.Bind(wx.EVT_TEXT_URL,self.GoToURL)
  2.  
then:
[code=python]
def GoToURL(self,event):
print event.
[code]
how to get the URL from the event? I think it's something like event.URL()???
thanks
While I'm checking, please read this section of the Posting Guidelines to learn how to use code tags. Thanks.
Jul 5 '07 #4
bartonc
6,596 Expert 4TB
While I'm checking, please read this section of the Posting Guidelines to learn how to use code tags. Thanks.
It looks like
Expand|Select|Wrap|Line Numbers
  1. event.GetString()
is the one you want.
Jul 5 '07 #5
nisyna
8
While I'm checking, please read this section of the Posting Guidelines to learn how to use code tags. Thanks.
OK sorry and thank you!
Jul 5 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Robert | last post: by
7 posts views Thread by SeeBelow | last post: by
1 post views Thread by mdk.R | last post: by
5 posts views Thread by Jared Russell | last post: by
reply views Thread by gopython | last post: by
5 posts views Thread by dynamo | last post: by
4 posts views Thread by Jimmy | last post: by
16 posts views Thread by Andrea Gavana | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.