Skip to content
Related Articles

Related Articles

PyQt5 – setInvertedAppearance() method for Progress Bar

View Discussion
Improve Article
Save Article
  • Last Updated : 22 Apr, 2020

When we create progress bar in PyQt5 by default the progress i.e the loading goes from left to right, but PyQt5 allows us to change its direction as well with the help of setInvertedAppearance method. It takes bool as argument and make the progress bar inverted.

Below is how normal progress bar and inverted progress bar looks like

Syntax : bar.setInvertedAppearance(True)

Argument : It takes bool as argument.

Action performed : It set set the progress bar to inverted appearance.

# importing libraries
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):
        # setting title
        self.setWindowTitle("Python ")
        # setting geometry
        self.setGeometry(100, 100, 600, 400)
        # calling method
        # showing all the widgets
    # method for widgets
    def UiComponents(self):
        # creating progress bar
        bar = QProgressBar(self)
        # setting geometry to progress bar
        bar.setGeometry(200, 100, 200, 30)
        # setting the value
        # setting alignment to center
        # making progress bar inverted
App = QApplication(sys.argv)
# create the instance of our Window
window = Window()
# start the app

Output :

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!