Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8385809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:45:46+00:00 2026-06-09T17:45:46+00:00

This is what I am trying to do: I create a window and there

  • 0

This is what I am trying to do:

I create a window and there is text that is displayed on it, as a user I click on the text,
example: the displayed text is.

'Hello World, I am a Python program.'

So if the user clicks words, I want it to generate an event and it would go into a function and I want to do something in the function (like changing the color of that word, so I also need to track which word I clicked)

I am not so sure how to do that, I could potentially make each word a button but that would be ugly.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:45:48+00:00Added an answer on June 9, 2026 at 5:45 pm
    import wx
    def SomeListener(evt):
        print "Got Event:",evt
        print "My XY:",evt.GetX(),evt.GetY()
        #youll have to figure out which word you clicked using x,y (note x,y relative to static text field)
    a= wx.App(redirect=False)
    f = wx.Frame(None,-1)
    p = wx.Panel(f,-1)
    t = wx.StaticText(p,-1,"Some Text")
    t.Bind(wx.EVT_LEFT_DOWN,SomeListener)
    f.Show()
    a.MainLoop()
    

    or using htmlwin … but it underlines all the words… I wasnt able to figure out how to not do that

    import wx
    
    import wx.html
    def OnClickWord(e):
        print "You Clicked:",e.GetLinkInfo().GetHref()
        return
    class MyHtmlFrame(wx.Frame):
    
        def __init__(self, parent, title):
    
            wx.Frame.__init__(self, parent, -1, title)
    
            html = wx.html.HtmlWindow(self)
    
            #if "gtk2" in wx.PlatformInfo:
    
            html.SetStandardFonts()
    
            html.SetPage(
            "<style>a {text-decoration: none;color: #000; }</style>" #sorry no css support :/
            "<a href=\"word1\">Word1</a> <a href=\"word2\">word 2</a> <a href=\"wizard of oz\">wizard of oz</a>.")
    
    app = wx.PySimpleApp()
    
    frm = MyHtmlFrame(None, "Simple HTML")
    frm.Bind(wx.html.EVT_HTML_LINK_CLICKED,OnClickWord)
    frm.Show()
    
    app.MainLoop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a child window in WPF.this child window should open
what i'm trying to do this this. Simply create a C# windows app that
I am trying to create a custom Output Window for my software that is
I'm trying to create a text widget that includes an entry form on top
I'm trying to create a window that will become a small popup window, containing
I am trying to create a script in Python that will collect data put
I'm trying to create a windows phone app with lots of texts like this
Im Trying to create this: |---------------------------------------------| | Panel 1a | Panel 2a | Panel
Trying to create a background-image slideshow and am getting this error... This is the
This is the HTML I'm trying to create: <td> Tiana is <select name=U4>...</select> keen

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.