Search code examples
pythonwxpython

wx python,HTTP link in text


I wanna add a link in a text but a found a solution, but it's don't work as well...

Then my code look like :

self.AddText('Some text here...'.decode('utf-8'))
self.AddText('Some text here too...'.decode('utf-8'))
self.linkweb = hl.HyperLinkCtrl(self, wx.ID_ANY, '[email protected]'.decode('utf-8'), URL="http://www.my_website.com/", pos=(545,88))

Then have you some ideas too make that more simple, cause here, i have to put my linkweb with the position in my frame... It's not really easy, and don't have the same positions, on all PC...

Thanks you all ;)


Solution

  • The wx.richtext.RichTextCtrl supports inserting hyperlinks in its text. You might be able to use the wx.TE_RICH style flag with a regular wx.TextCtrl to get the same capabilities, but I'm not sure if that will work. See the wxPython demo for a good example.