Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GUI Progress Bar
#7
I am trying to implement circular progress bar. code is below-
import numpy as np
import math
import matplotlib
import time

def update_bar(steps,lastPos,xc,yc):
percent = lastPos + 2
lastPos = max(1,lastPos)
theta = steps[lastPos:percent]
iX = 0.45*np.cos(theta) + xc
iY = 0.45*np.sin(theta) + yc
oX = 0.35*np.cos(theta) + xc
oY = 0.35*np.sin(theta) + yc
xx = np.matrix(np.zeros([len(theta)*2+1]))
yy = np.matrix(np.zeros([len(theta)*2+1]))
xx[:,0:len(iX)]=iX
xx[:,len(iX):(len(oX)+len(iX))] = oX[::-1]
xx[:,len(theta)*2] = iX[0]
yy[:,0:len(iY)]=iY
yy[:,len(iY):(len(oY)+len(iY))] = oY[::-1]
yy[:,len(theta)*2] = iY[0]
#
# xx = [iX[0], iX[1:len(iX)], oX[::-1], iX[0]]
# yy = [iY[0], iY[1:len(iY)], np.fliplr(oY), iY[0]]
color = [0.91, 0.47, 0.17]
matplotlib.patches( xx, yy)#, color, 'EdgeColor'= color)



def main():
# fig = matplotlib.pyplot.figure()
theta = np.arange(-math.pi,math.pi,0.01,dtype=float)
xc = 0.5
yc = 0.5
x = 0.45*np.cos(theta) + xc
y = 0.45*np.sin(theta) + yc
x1 = 0.35*np.cos(theta) + xc
y1 = 0.35*np.sin(theta) + yc
matplotlib.pyplot.axis('equal')
matplotlib.pyplot.hold(True)
matplotlib.pyplot.plot(x,y,'black',x1,y1,'black')
matplotlib.pyplot.yticks([0,0])
matplotlib.pyplot.xticks([0,0])
# matplotlib.pyplot.hold(False)
# matplotlib.pyplot.show()
steps = np.linspace(-1.5*math.pi, 0.5*math.pi, 100, dtype = float)
lastPos = 0;
for i in range(0,100):
time.sleep(0.001)
# if i>0:
# delete(h)

update_bar(steps,lastPos,xc,yc)
# h = text ( 0.5, 0.5, [str(i) '%'], 'HorizontalAlignment', 'center' );
lastPos = lastPos + 2
if lastPos == 100:
break

main()

please help me, it's not running
Reply


Messages In This Thread
GUI Progress Bar - by Anysja - Aug-21-2018, 10:54 PM
RE: GUI Progress Bar - by Larz60+ - Aug-22-2018, 02:34 AM
RE: GUI Progress Bar - by Axel_Erfurt - Aug-22-2018, 07:29 AM
RE: GUI Progress Bar - by Anysja - Aug-22-2018, 05:48 PM
RE: GUI Progress Bar - by Axel_Erfurt - Aug-22-2018, 06:18 PM
RE: GUI Progress Bar - by Anysja - Aug-22-2018, 06:54 PM
RE: GUI Progress Bar - by swetanjali - Aug-29-2018, 02:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How can I measure progress and display it in the progress bar in the interface? Matgaret 2 5,985 Dec-11-2019, 03:30 PM
Last Post: Denni
  [Tkinter] Progress Bar While Sending an Email maxtimbo 3 4,153 Oct-09-2019, 09:13 PM
Last Post: woooee
  Progress Bar While Sending an Email maxtimbo 0 2,144 Oct-08-2019, 02:13 PM
Last Post: maxtimbo
  [PyQt] cant import progress bar from another py file swipis 7 8,711 Dec-18-2016, 10:41 AM
Last Post: swipis

Forum Jump:

User Panel Messages

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