Pyqt5 can provide you this:
import random
import sys
import time
from PyQt5.QtWidgets import QApplication, QDialog, QProgressBar, QVBoxLayout
class Actions(QDialog):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
layout = QVBoxLayout(self)
maxi = max(list_.values())
for el in list_:
bar = QProgressBar(self)
bar.setRange(0, maxi)
bar.setFormat(f"{el}: {list_[el]}mg (%p%)")
bar.setValue(list_[el])
layout.addWidget(bar)
self.show()
if __name__ == "__main__":
list_ = {
"Vitamin A": 902,
"Vitamin B1": 350,
"Vitamin B2": 420,
"Vitamin B3": 15.83,
"Vitamin B5": 2.94,
}
app = QApplication(sys.argv)
window = Actions()
sys.exit(app.exec_())
Indeed you need to add theme, colors and other thing to have good render.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.