Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since is using wx.python, use a Delayedresult, look at wx demos for a complete example.</p> <p>Full minimal example:</p> <pre><code>import wx import wx.lib.delayedresult as inbg import time class Player(wx.Frame): def __init__(self): self.titulo = "Music Player" wx.Frame.__init__(self, None, -1, self.titulo,) self.jobID = 0 self.Vb = wx.BoxSizer(wx.VERTICAL) self.panel = wx.Panel(self,-1) self.playlist = ['one','two'] self.abortEvent = inbg.AbortEvent() self.msg = wx.StaticText(self.panel, -1, "...",pos=(30,-1)) self.msg.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.BOLD)) self.action = wx.Button(self.panel, -1,"Play Playlist") self.Bind(wx.EVT_BUTTON, self.StartPlaying,self.action) self.Vb.Add(self.msg, 0, wx.EXPAND|wx.ALL, 3) self.Vb.Add(self.action, 0, wx.EXPAND|wx.ALL, 3) self.panel.SetSizer(self.Vb) self.Show() def StartPlaying(self,evt): self.BgProcess(self.Playme) def Playme(self,jobID, abortEvent): print "in bg" list = self.getPlayList() print list for music in list: self.msg.SetLabel('Playing: %s' % music) stop = 100 while stop &gt; 0: print stop stop -=1 self.msg.SetLabel('Playing: %s [%s ]' % (music,stop)) def _resultConsumer(self, inbg): jobID = inbg.getJobID() try: result = inbg.get() return result except Exception, exc: return False def getPlayList(self): return self.playlist def setPlayList(self,music): self.playlist.appdend(music) def BgProcess(self,executar): self.abortEvent.clear() self.jobID += 1 inbg.startWorker(self._resultConsumer, executar, wargs=(self.jobID,self.abortEvent), jobID=self.jobID) app = wx.App(False) demo = Player() app.MainLoop() </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload