How to add clickable/linkable/hyperlink to text. (more explanation inside, not as simple i assume)

Hi, i’m rather new to wxpython, and i am in need of directions/guidance on what to use to make this possible.

i would like to create a scrollable window that i may add text to, and not only add text, but would like to add some text from time to time that is clickable, meaning on a specicifed text that i add, i would like to be able to click on the text and link it to a certain action (not a url). I have tried more or less adding hyperlinkctrl to a textctrl window, but it places the text in weird places, i simply want to add the text to lets say the last line in the text.

basically, i have a text window that i can scroll through, and i would like to add from time to time linkable text to the last line that will trigger a function/action i want it to, such as pop open a message box.

the most i have been able to achieve is adding a hyper link in the text window, but it places it at the top of the text window, and when i scroll down it suddenly changes places, does wierd things.

i assume this has been done before, would appreciate some guidance on what to use to make this work.

If it is possilbe, an example would be great, if it not alot of work

thanks in advance.

Oliver greenswood wrote:

Hi, i'm rather new to wxpython, and i am in need of directions/guidance
on what to use to make this possible.

i would like to create a scrollable window that i may add text to, and
not only add text, but would like to add some text from time to time
that is clickable, meaning on a specicifed text that i add, i would like
to be able to click on the text and link it to a certain action (not a
url). I have tried more or less adding hyperlinkctrl to a textctrl
window, but it places the text in weird places, i simply want to add the
text to lets say the last line in the text.

basically, i have a text window that i can scroll through, and i would
like to add from time to time linkable text to the last line that will
trigger a function/action i want it to, such as pop open a message box.

the most i have been able to achieve is adding a hyper link in the text
window, but it places it at the top of the text window, and when i
scroll down it suddenly changes places, does wierd things.

Because adding a widget to the textctrl is not at all the same as adding simple text. They are 2 separate entities in a parent child relationship, not just a bit of data added to a single entity.

i assume this has been done before, would appreciate some guidance on
what to use to make this work.

The wx.TextCtrl has a flag that can be used to have it turn URLs into links that send an event when clicked, but it sounds like you want text other than URLs to be links. Have you looked at HtmlWindow?

···

--
Robin Dunn
Software Craftsman