python Programming Glossary: self.queue
GTK window capture: VPython (OpenGL) application http://stackoverflow.com/questions/10934787/gtk-window-capture-vpython-opengl-application def __init__ self queue threading.Thread.__init__ self self.queue queue self.name 'OpenGLThread' def run self gtk.threads_enter.. #P subprocess.Popen 'python' 'opengl.py' time.sleep 2 self.queue.put self.find_window_id self.queue.task_done def find_window_id.. time.sleep 2 self.queue.put self.find_window_id self.queue.task_done def find_window_id self Gets the OpenGL window ID...
Mutli-threading python with Tkinter http://stackoverflow.com/questions/14379106/mutli-threading-python-with-tkinter expand False self._oid self.canvas.after 10 self.move self.queue queue self.canvas.after 50 self.check_queue def check_queue.. self.check_queue def check_queue self try x y rad outline self.queue.get block False except Queue.Empty pass else self.create_moving_ball..
How to connect a progress bar to a function? http://stackoverflow.com/questions/15323574/how-to-connect-a-progress-bar-to-a-function import time class GuiPart def __init__ self master queue self.queue queue self.pgBar ttk.Progressbar master orient 'horizontal'.. 1 column 0 padx 20 pady 20 def processIncoming self while self.queue.qsize try msg self.queue.get 0 self.lb.insert 'end' msg .. def processIncoming self while self.queue.qsize try msg self.queue.get 0 self.lb.insert 'end' msg self.pgBar.step 25 except Queue.Empty..
multiprocessing GUI schemas to combat the “Not Responding” blocking http://stackoverflow.com/questions/15698251/multiprocessing-gui-schemas-to-combat-the-not-responding-blocking self parent worker QtCore.QThread.__init__ self parent self.queue mp.Queue self.worker worker self.parent parent self.process.. mp.Process target self.worker.some_complex_processing args self.queue # When the process button is pressed this function will start.. self self.process.start while True try message self.queue.get self.update_signal.emit message except EOFError pass if..
How check if a task is already in python Queue? http://stackoverflow.com/questions/1581895/how-check-if-a-task-is-already-in-python-queue SetQueue Queue def _init self maxsize self.maxsize maxsize self.queue set def _put self item self.queue.add item def _get self return.. self.maxsize maxsize self.queue set def _put self item self.queue.add item def _get self return self.queue.pop As Paul McGuire.. _put self item self.queue.add item def _get self return self.queue.pop As Paul McGuire pointed out this would allow adding a duplicate..
It is possible export table sqlite3 table to csv or similiar? http://stackoverflow.com/questions/4264379/it-is-possible-export-table-sqlite3-table-to-csv-or-similiar csv.excel encoding utf 8 kwds # Redirect output to a queue self.queue cStringIO.StringIO self.writer csv.writer self.queue dialect.. queue self.queue cStringIO.StringIO self.writer csv.writer self.queue dialect dialect kwds self.stream f self.encoder codecs.getincrementalencoder.. for s in row # Fetch UTF 8 output from the queue ... data self.queue.getvalue data data.decode utf 8 # ... and reencode it into the..
Python DictWriter writing UTF-8 encoded CSV files http://stackoverflow.com/questions/5838605/python-dictwriter-writing-utf-8-encoded-csv-files csv.excel encoding utf 8 kwds # Redirect output to a queue self.queue cStringIO.StringIO self.writer csv.DictWriter self.queue fieldnames.. self.queue cStringIO.StringIO self.writer csv.DictWriter self.queue fieldnames dialect dialect kwds self.stream f self.encoder codecs.getincrementalencoder.. v in D.items # Fetch UTF 8 output from the queue ... data self.queue.getvalue data data.decode utf 8 # ... and reencode it into the..
Parallel file matching, Python http://stackoverflow.com/questions/7623211/parallel-file-matching-python Recurser threading.Thread def __init__ self queue dir self.queue queue self.dir dir threading.Thread.__init__ self def run self.. root subFolders files in os.walk rootDir for file in files self.queue.put os.path.join root file self.queue.put 1 self.queue.put 1.. for file in files self.queue.put os.path.join root file self.queue.put 1 self.queue.put 1 self.queue.put 1 self.queue.put 1 self.queue.put..
|