These 5-6 buttons will be chosen from 3 excel sheets based by the user values set in a QSpinBox (values 1-20) and a QSlider (values 1-3). Then the buttons will be generated by a QButton and each button can be closed after user interaction.
IE: A user setting of QSpinBox "1" will pull randomly from row 1 values and QSLider "1" will select the specific sheet one. Next when QButton is pressed the 5-6 buttons will populate. Clicking on the buttons will generate a note which then can be closed and that button disappears.
So far I have my main window and I can load a user image into a label which I want the random buttons to generate over
Expand|Select|Wrap|Line Numbers
- from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QLabel, QFileDialog
- from PyQt5 import uic
- from PyQt5.QtGui import QPixmap
- import sys
- class UI(QMainWindow):
- def __init__(self):
- super(UI, self).__init__()
- # Load the ui file
- uic.loadUi("TEST2.ui", self)
- # Define widgets
- self.button = self.findChild(QPushButton, "pushButton")
- self.label = self.findChild(QLabel, "label")
- # Click The Dropdown Box
- self.button.clicked.connect(self.clicker)
- # Show The App
- self.show()
- def clicker(self):
- fname = QFileDialog.getOpenFileName(self, "Open File", "c:\\gui\\images", "All Files (*);;PNG Files (*.png);;Jpg Files (*.jpg)")
- # Open The Image
- if fname:
- self.pixmap = QPixmap(fname[0])
- # Add Pic to label
- self.label.setPixmap(self.pixmap)
- # Initialize The App
- app = QApplication(sys.argv)
- UIWindow = UI()
- app.exec_()