473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 2100
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

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

Similar topics

3
by: Robert | last post by:
Hello list, could somebody point me to a good reference about wxPython event handling? I have seen many examples but which one is the best. Waht are the advantages and disadvantages? Can you...
7
by: SeeBelow | last post by:
Do many people think that wxPython should replace Tkinter? Is this likely to happen? I ask because I have just started learning Tkinter, and I wonder if I should abandon it in favor of...
1
by: mdk.R | last post by:
Hello all: i'am installed wxPython 2.5 and Python2.3.4..i try execute script with wxPython but it show error: Traceback (most recent call last): File "E:\py\test.py", line 7, in ? import wx...
5
by: Jared Russell | last post by:
I've recently decided to try my hand at GUI programming with wxPython, and I've got a couple questions about the general conventions regarding it. To mess around with it, I decided to create a...
9
by: zxo102 | last post by:
Hi everyone, I am using a python socket server to collect data from a socket client and then control a image location ( wxpython) with the data, i.e. moving the image around in the wxpython frame....
0
by: gopython | last post by:
Hi, I just started coding with wxPython. The idea is to be able to change the gui dynamically. I am trying to change the static text inside the panel after the panel is created without user...
5
by: dynamo | last post by:
Hi everyone.I'm new to wxpython.And i have a little problem.I tried to run the following wxpython app code in IDLE for python25: import wx import os import re def z(a): for i in...
1
by: defireman | last post by:
Hi, Sorry for asking a newbie question, but I am currently using wxPython 2.6, and I don't know how to get the properties of an event object in wxPython when handling events. Is there some sort of...
4
by: Jimmy | last post by:
hi, all I'm having a problem with creating custom events in wxpython. I have a class A handling some data processing work and another class B of GUI matter. I need GUI to display information...
16
by: Andrea Gavana | last post by:
Hi Diez & All, Do you mind explaining "why" you find it *buttugly*? I am asking just out of curiosity, obviously. I am so biased towards wxPython that I won't make any comment on this thread...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.