Continued from last time Last time I was able to confirm that the application started for the time being, but I tried adding various missing parts such as prevention of double startup
It is published on github. https://github.com/snowpff14/etcresource/tree/master/pythonGui
See Last time for a rough part.
def doExecute(self):
if self.lock.acquire(blocking=FALSE):
if messagebox.askokcancel('Confirmation before execution','Do you want to perform the process?'):
self.progressValue=0
self.progressStatusBar.configure(value=self.progressValue)
self.progressBar.configure(maximum=10,value=0)
self.progressBar.start(100)
th = threading.Thread(target=self._executer)
th.start()
else:
self.lock.release()
else:
messagebox.showwarning('error','Processing is in progress')
PL.TLabel
is an item that can be set arbitrarily. This is specified when defining the label in the latter part. labelStyle=ttk.Style()
labelStyle.configure('PL.TLabel',font=('Helvetica',10,'bold'),background='white',foreground='red')
self.progressMsgBox=ttk.Label(content,textvariable=self.progressMsg,width=70,style='PL.TLabel')
self.progressMsg.set('Waiting for processing')
def progressSequence(self,msg,sequenceValue=0):
self.progressMsg.set(msg)
self.progressValue=self.progressValue+sequenceValue
self.progressStatusBar.configure(value=self.progressValue)
method of the screen element as shown below. The display area is updated with
root.update_idletasks ()` in order to change the screen after processing is executed. self.progressMsgBox.after(10,self.progressSequence('Processing is in progress',sequenceValue=50))
root.update_idletasks()
determinate
is used to indicate how far you have progressed in the overall progress. self.progressBar=ttk.Progressbar(content,orient=HORIZONTAL,length=140,mode='indeterminate')
self.progressBar.configure(maximum=10,value=0)
self.progressStatusBar=ttk.Progressbar(content,orient=HORIZONTAL,length=140,mode='determinate')
determinate
, if you set a value in value
, it will advance by that amount (set the maximum value to 100 according to the situation) starts at
startand stops at
stop` self.progressValue=0
self.progressStatusBar.configure(value=self.progressValue)
self.progressBar.configure(maximum=10,value=0)
self.progressBar.start(100)
def preparation(self,logfilename):
self._executer=partial(self.execute,logfilename)
So far this time for the time being. If I can do something a little more, I will create a continuation.
Recommended Posts