Python PyQt5 – Hiding the Progress Bar ?
Last Updated :
16 Jan, 2023
In this article we will see how to hide the progress bar in PyQt5 application. There two ways in which we can hide the progress –
- Using hide method.
- Setting visibility status of progress bar to False.
Method #1 : With the help of hide method, we can hide the progress bar. Below is the implementation.
Python3
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 , 100 , 200 , 30 )
bar.setValue( 100 )
bar.setFormat("Welcome geeks to geeks portal")
bar.setAlignment(Qt.AlignCenter)
bar.hide()
App = QApplication(sys.argv)
window = Window()
sys.exit(App. exec ())
|
Output : Method #2: With the help of SetVisible method, we can hide the progress bar. Below is the implementation.
Python3
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 , 100 , 200 , 30 )
bar.setValue( 100 )
bar.setFormat("Welcome geeks to geeks portal")
bar.setAlignment(Qt.AlignCenter)
bar.setVisible( False )
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...