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

  • Home
  • SEARCH
  • 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 7974965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:31:28+00:00 2026-06-04T08:31:28+00:00

I have built PyGTK application with matplotlib graph in it. I also would like

  • 0

I have built PyGTK application with matplotlib graph in it. I also would like to use custom built tooltip windows. Tooltip value changes according to mouse position on graph.

My problem is that, i can not move my tooltip windows next to my mouse, because i dont know how to get mouse position in screen

Here is my stripped code:

def figPrepare(self):   #initialize graph
        #figure preparation stuff

        #custom tooltip window
        tooltip = gtk.Window(gtk.WINDOW_POPUP)
        lbl = gtk.Label()
        tooltip.add(lbl)
        lbl.show()

        figure.canvas.set_tooltip_window(tooltip)
        figure.canvas.props.has_tooltip = True
        #events
        figure.canvas.mpl_connect('figure_enter_event',lambda w: tooltip.show())
        figure.canvas.mpl_connect('motion_notify_event',lambda w: self.updateTooltip(tooltip, lbl))
        figure.canvas.mpl_connect('figure_leave_event',lambda w: tooltip.hide())


    def updateTooltip(self, win, lbl):
        lbl.set_text(str(time.time()))
        win.move(w.x, w.y)

This code moves tooltip window, but values are based on matplotlib graph, not absolute position in screen.

Could someone point me how to move tooltip windows next to mouse pointer?

  • 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-04T08:31:29+00:00Added an answer on June 4, 2026 at 8:31 am

    I found solution:

    def updateTooltip(self, win, lbl):
        lbl.set_text(str(time.time()))
        x, y, mods = win.get_screen().get_root_window().get_pointer()   #this gets absolute mouse possition on screen
        win.move(x+15, y+10)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built an application in C# that I would like to be optimized
I have an application which depends on PyGTK, PyGobject, and PyCairo that I built
I have built a basic theme for my Flex app. I would like to
I have built an MSI that I would like to deploy, and update frequently.
I have built an application in which I use sqlite to store data. It
I have built UI, its like a search engine for BioProcess/Disease--> Genes. e.g., User
We have built a web application that accepts SOAP messages, does some processing, calls
I have built a T-SQL query like this: DECLARE @search nvarchar(1000) = 'FORMSOF(INFLECTIONAL,hills) AND
i have built application using codeigniter, my controller name is userReg , in controller
I have built a one page web application that manipulates a set of data:

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.