modal dialog and tipwindow not getting along

I'm doing a multithreaded network application that uses Queue objects to manage communication between the threads. If a modal dialog gets launched while a wxTipWindow is displayed, it causes my system to lock. I have to hit ctrl-alt-backspace to get out of X. Although the example below is not realistic, I think it's close enough, and it does demonstrate this behavior. Is this a bug or a feature?

I'm using Linux, python 2.2, and wxPython 2.4.1.2

#!/usr/bin/env python

from wxPython.wx import *

class ListFrame(wxFrame):

  def __init__(self):
    wxFrame.__init__(self, NULL, -1, 'Frame')
    self.list = wxListCtrl(self, 10000, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER | wxLC_REPORT | wxLC_SINGLE_SEL)
    self.list.InsertColumn(0, '')
    for i in range(0, 100):
      self.list.InsertStringItem(i, str(i))
    self.tipShown = -1
    EVT_MOTION(self.list, self.OnMotion)
    
  def OnMotion(self, event):
    x, y = event.GetPosition()
    (index, flags) = self.list.HitTest(wxPoint(x, y))
    if index != -1 and index != self.tipShown:
      rect = self.list.GetItemRect(index)
      left, top = self.list.ClientToScreenXY(rect.x, rect.y)
      right, bottom = self.list.ClientToScreenXY(rect.GetRight(), rect.GetBottom())
      rect = wxRect(left, top, right - left + 1, bottom - top + 1)
      txt = self.list.GetItem(index, 0).GetText()
      self.tip = wxTipWindow(self, txt)
      self.tip.SetBoundingRect(rect)
      self.tipShown = index
      dialog = wxMessageDialog(self, 'This function has yet to be implemented.', 'Not Implemented', wxOK | wxICON_ERROR)
      dialog.ShowModal()

class PYoo(wxApp):

  def OnInit(self):
    self.frame = ListFrame()
    self.frame.Show(1)
    self.SetTopWindow(self.frame)
    return 1

app = PYoo()
app.MainLoop()

Scott wrote:

I'm doing a multithreaded network application that uses Queue objects
to manage communication between the threads. If a modal dialog gets
launched while a wxTipWindow is displayed, it causes my system to
lock. I have to hit ctrl-alt-backspace to get out of X. Although
the example below is not realistic, I think it's close enough, and it
does demonstrate this behavior. Is this a bug or a feature?

Definitly not a feature, but it is quesionable whether it is a bug or
not. The issue is that the wxTipWindow captures the mouse, then you
show the dialog which is modal so it disables all other interaction with
the other windows (including the tip window) in the app. So you end up
in a deadlock of sorts, you can't click on the button in the dialog
because the mouse is captured, but you can't dismiss the tip window
either because of the dialog...

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Thanks. I'm trying to think of a good workaround, but it seems like it will get messy. :slight_smile:

···

On Mon, 07 Jul 2003 16:59:31 -0700 Robin Dunn <robin@alldunn.com> wrote:

Scott wrote:
> I'm doing a multithreaded network application that uses Queue objects
> to manage communication between the threads. If a modal dialog gets
> launched while a wxTipWindow is displayed, it causes my system to
> lock. I have to hit ctrl-alt-backspace to get out of X. Although
> the example below is not realistic, I think it's close enough, and it
> does demonstrate this behavior. Is this a bug or a feature?
>

Definitly not a feature, but it is quesionable whether it is a bug or
not. The issue is that the wxTipWindow captures the mouse, then you
show the dialog which is modal so it disables all other interaction with
the other windows (including the tip window) in the app. So you end up
in a deadlock of sorts, you can't click on the button in the dialog
because the mouse is captured, but you can't dismiss the tip window
either because of the dialog...