Hi
I'm French so sorry for bad english.
I slightly modified the code of the example ContextHelp.py
who came with wxpython sources so that the wxApp starts in
a thread.
In the following example when I click the help button then on
a control the wxTipWindow displays. Then if we click in the
wxtipwindow everything is well the wxtipwindow disappear
but if we click in another widget (on the button for example)
the entire window freeze!!!
Is somebody would have an explanation?
Thank you in advance
from wxPython.wx import *
from wxPython.help import *
import threading
provider = wxSimpleHelpProvider()
wxHelpProvider_Set(provider)
class TestPanel(wxPanel):
def __init__(self, parent):
wxPanel.__init__(self, parent, -1)
self.SetHelpText("This is a wxPanel.")
sizer = wxBoxSizer(wxVERTICAL)
cBtn = wxContextHelpButton(self)
cBtn.SetHelpText("wxContextHelpButton")
cBtnText = wxStaticText(self, -1, "This is a wxContextHelpButton.
Clicking it puts the\n"
"app into context sensitive help
mode.")
cBtnText.SetHelpText("Some helpful text...")
s = wxBoxSizer(wxHORIZONTAL)
s.Add(cBtn, 0, wxALL, 5)
s.Add(cBtnText, 0, wxALL, 5)
sizer.Add(20,20)
sizer.Add(s)
text = wxTextCtrl(self, -1, "Each sub-window can have its own help
message",
size=(240, 60), style = wxTE_MULTILINE)
text.SetHelpText("This is my very own help message. This is a
really long message!")
sizer.Add(20,20)
sizer.Add(text)
border = wxBoxSizer(wxVERTICAL)
border.Add(sizer, 0, wxALL, 25)
self.SetAutoLayout(True)
self.SetSizer(border)
self.Layout()
class Make_Thread(threading.Thread) :
def __init__(self, win_threaded):
self.win_threaded = win_threaded
threading.Thread.__init__(self)
def run(self):
self.win_threaded.MainLoop()
if __name__ == '__main__':
class MyFrame(wxFrame):
def __init__(self,parent=None):
wxFrame.__init__(self,parent,-1, "Please make a selection...")
self. panel = TestPanel(self)
EVT_CLOSE (self,self.OnCloseWindow)
def OnCloseWindow(self,event):
self.panel.Close()
self.Destroy()
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame()
frame.Show(True)
self.SetTopWindow(frame)
return True
app = MyApp(0)
wxWin_t = Make_Thread(app)
wxWin_t.start()
Ce message et les pièces jointes sont confidentiels et établis à
l'attention exclusive de ses destinataires. Toute utilisation ou diffusion,
même partielle, non autorisée est interdite. Tout message électronique est
susceptible d'altération. RTE décline toute responsabilité au titre de ce
message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas le
destinataire de ce message, merci de le détruire et d'avertir l'expéditeur.
This message and any attachments are confidential and intended solely for
the addressees.Any unauthorized use or disclosure, either whole or partial
is prohibited. E-mails are susceptible to alteration. RTE shall not be
liable for the message if altered, changed or falsified. If you are not the
intended recipient of this message, please delete it and notify the sender.