the program is suppose to give you a quote every time i press the button
import csv
import random as r
import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
data_list = []
with open(r'C:\csvquotes.csv', mode='r') as file:
csv_reader = csv.reader(file)
for row in csv_reader:
data_list.append(row)
def window():
global b
global w
app = QApplication(sys.argv)
w = QWidget()
b = QLabel(w)
b.setText("")
b.setGeometry(50000, 50000,1000,100)
w.button = QPushButton("click me", w)
w.button.clicked.connect(on_click)
w.button.setGeometry(150, 200, 200, 100)
w.setGeometry(100, 100, 500, 500)
b.move(50, 20)
w.setWindowTitle("PyQt5")
w.show()
sys.exit(app.exec_())
def on_click():
random_quote = r.choice(data_list)[0]
b.setText("")
print(random_quote)
b.setText(random_quote)
if __name__ == '__main__':
window()
i use pyqt5 since ive used pyautogui for something else earlier and i wanted to try something new idk what is better