title: wxPython popup / tooltip on a wx.DrawRectangle?
body: <p>In the code below, DrawRect1 and DrawRect2 represent a simplified version of functions that draw multiple shapes on screen.</p>
  
  <p>I want to display some supplementary information if I hover over any of the drawn rectangles (similar to the way a tooltip works). But I need to generate that display information from a function rather than static definition.</p>
  
  <p>Given I know the coords of the draw rectangle, can I either create another type of object with the same coords, or link a hover action to each drawnrectangle, so that I could call a function defined something like this ? :</p>
  
  <p>EDIT: I guess I need a object I can bind a wx.EVT_ENTER_WINDOW event to, that I can create at the same time as dc.DrawRectangle ? Or can I bind this handler to the panel and use x,y position to try and match to a list of drawn rectangle coords ?</p>
  
  <p>The closest thing I could find on SO was this old question, <a href="https://stackoverflow.com/questions/29059569/wxpython-tooltip-at-specific-coordinates">wxpython tooltip at specific coordinates</a> but it wasn't a comprehensive answer.  </p>
  
  <pre><code>import wx
  
  
  class Mywin(wx.Frame):
  
      def __init__(self, parent, title):
          super(Mywin, self).__init__(parent, title=title, size=(500, 300))
  
          self.InitUI()
  
      def InitUI(self):
  
          self.panel = wx.Panel(self)
          self.panel.SetBackgroundColour(wx.Colour('RED'))
  
  
          self.Centre()
          self.Show(True)
  
          menuBar = wx.MenuBar()
          RectangleButton = wx.Menu()
  
          Item1 = RectangleButton.Append(wx.ID_ANY, 'Rectangle 1')
          Item2 = RectangleButton.Append(wx.ID_ANY, 'Rectangle 2')
  
          menuBar.Append(RectangleButton, 'Rectangles')
  
          self.SetMenuBar(menuBar)
  
          self.Bind(wx.EVT_MENU, self.DrawRect1, Item1)
          self.Bind(wx.EVT_MENU, self.DrawRect2, Item2)
  
  
      def DrawRect1(self, e):
          self.panel.SetBackgroundColour(wx.Colour('BLUE'))
          self.Refresh()
          self.Update()
          self.dc = wx.ClientDC(self.panel)
          self.dc.SetBrush(wx.Brush(wx.Colour('white')))
          self.dc.DrawRectangle(10, 10, 100, 100)
  
      def DrawRect2(self, e):
          self.panel.SetBackgroundColour(wx.Colour('GREEN'))
          self.Refresh()
          self.Update()        
          self.dc = wx.ClientDC(self.panel)
          self.dc.SetBrush(wx.Brush(wx.Colour('white')))
          self.dc.DrawRectangle(20, 20, 50, 50)
  
  myApp = wx.App()
  Mywin(None,'Drawing demo')
  myApp.MainLoop()
  </code></pre>