Python Forum
[WxPython] Using thread in the wxPython
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WxPython] Using thread in the wxPython
#6
It seems to me that your thread's main action is the self.run() and that this call does not use the wxpython GUI (tell me if I'm wrong). This main task of the thread must not go under anythread. The decorator is used to wrap parts that update the GUI. You could perhaps cut this in
def button_run(self, event):
    ''' @brief Call to run KiCost.'''
    event.Skip()
    self.run_kicost_guide()
 
@anythread
def foo(self):
    self.m_gauge_process.SetValue(0)
    self.m_button_run.Disable()
    self.save_properties() # Save the current graphical configuration before call the KiCost motor.
    logger.log(DEBUG_OVERVIEW, 'Starting the KiCost scrape process.')

def run_kicost_guide(self):
    '''Run the as a Thread out of the box wxPython'''
    self.foo()
    self.run() # Run KiCost.
    self.bar()

@anythread
def bar(self):
    init_distributor_dict() # Restore distributors removed during the execution of KiCost motor.
    self.m_button_run.Enable()
Reply


Messages In This Thread
Using thread in the wxPython - by hildogjr - Aug-07-2018, 03:47 PM
RE: Using thread in the wxPython - by Gribouillis - Aug-07-2018, 07:47 PM
RE: Using thread in the wxPython - by hildogjr - Aug-08-2018, 05:31 PM
RE: Using thread in the wxPython - by Gribouillis - Aug-08-2018, 07:44 PM
RE: Using thread in the wxPython - by hildogjr - Aug-08-2018, 08:12 PM
RE: Using thread in the wxPython - by Gribouillis - Aug-08-2018, 08:47 PM
RE: Using thread in the wxPython - by hildogjr - Aug-09-2018, 07:52 PM
RE: Using thread in the wxPython - by Gribouillis - Aug-09-2018, 08:51 PM
RE: Using thread in the wxPython - by hildogjr - Aug-11-2018, 02:59 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020