PyQt5 – minimum() method for Progress Bar
Last Updated :
22 Apr, 2020
Progress Bar is a widget that is used when we process lengthy tasks. It is animated so that the user knows that the task is progressing, it is basically graphical control element used to visualize the progression of an extended computer operation, such as a download, file transfer, or installation.
We can set the minimum value of progress bar using setMinimum
method, minimum
method is used to get the minimum value of desired progress bar.
Syntax : bar.minimum()
Argument : It takes no argument.
Return : It returns integer which refers the minimum value of progress bar.
Code :
from PyQt5.QtWidgets import *
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import sys
class Window(QMainWindow):
def __init__( self ):
super ().__init__()
self .setWindowTitle( "Python " )
self .setGeometry( 100 , 100 , 600 , 400 )
self .UiComponents()
self .show()
def UiComponents( self ):
bar = QProgressBar( self )
bar.setGeometry( 200 , 150 , 200 , 30 )
bar.setMinimum( 50 )
bar.setValue( 98 )
value = bar.minimum()
label = QLabel( "minimum value = " + str (value), self )
label.adjustSize()
label.move( 200 , 200 )
bar.setAlignment(Qt.AlignCenter)
App = QApplication(sys.argv)
window = Window()
sys.exit(App. exec ())
|
Output :
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...