wxPython更改鼠标光标以通知长时间运行的操作

2024-03-28 09:49:35 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在构建一个Python程序,它可以搜索远程网站上的内容。 有时操作需要很多秒,我相信用户不会注意到状态栏消息“搜索操作正在进行”。 因此,我想更改鼠标光标以突出显示程序仍在等待结果。

这是我正在使用的方法:

def OnButtonSearchClick( self, event ):
        """
        If there is text in the search text, launch a SearchOperation.
        """
        searched_value = self.m_search_text.GetValue()

        if not searched_value:
            return

        # clean eventual previous results
        self.EnableButtons(False)
        self.CleanSearchResults()

        operations.SearchOperation(self.m_frame, searched_value)

我尝试了两种不同的方法,都在最后一行之前:

  • wx.BeginBusyCursor()
  • self.m_frame.SetCursor(wx.StockCursor(wx.CURSOR_WAIT))

他们都不工作。

我在GNU/Linux下使用KDE。这在侏儒的统治下也行不通

有什么线索吗?谢谢你


Tags: 方法text用户self程序内容search远程