Advertisement
shh_algo_PY

Crazy People

Jun 19th, 2022
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.69 KB | None | 0 0
  1. # Import all necessary modules
  2. # Putting a bracket allows you to type them on more than one line
  3. # Easier to check for typos and making sure you have everything you need
  4.  
  5. from PyQt5.QtCore import Qt
  6. from PyQt5.QtWidgets import (
  7.     QApplication, QWidget,  QPushButton,
  8.     QHBoxLayout, QVBoxLayout, QLabel,
  9.     QMessageBox, QRadioButton)
  10.  
  11. # WINNING & LOSING
  12. # One definition of 'winning' and one definition of 'losing'
  13.  
  14. def show_win():
  15.    pass
  16.  
  17. def show_lose():
  18.    pass
  19.  
  20. # This section is to make a window
  21. app = QApplication([])
  22. main_win = QWidget()
  23. main_win.setWindowTitle('Add your own title here!')
  24. main_win.resize(400, 200)
  25.  
  26. # These are your Questions and Answers
  27. question = QLabel('Add your question here')
  28. btn_answer1 = QRadioButton('Answer 1')
  29. btn_answer2 = QRadioButton('Answer 2')
  30. btn_answer3 = QRadioButton('Answer 3')
  31. btn_answer4 = QRadioButton('Answer 4')
  32.  
  33. # These are the layouts
  34. layout_main = QVBoxLayout()         # V for Vertical layout
  35. layoutH1 = QHBoxLayout()            # H for Horizontal layout
  36. layoutH2 = QHBoxLayout()
  37. layoutH3 = QHBoxLayout()
  38. layoutH1.addWidget(question, alignment = Qt.AlignCenter)
  39. layoutH2.addWidget(btn_answer1, alignment = Qt.AlignCenter)
  40. layoutH2.addWidget(btn_answer2, alignment = Qt.AlignCenter)
  41. layoutH3.addWidget(btn_answer3, alignment = Qt.AlignCenter)
  42. layoutH3.addWidget(btn_answer4, alignment = Qt.AlignCenter)
  43.  
  44. layout_main.addLayout(layoutH1)
  45. layout_main.addLayout(layoutH2)
  46. layout_main.addLayout(layoutH3)
  47. main_win.setLayout(layout_main)
  48.  
  49. # Add what happens when the button is pressed
  50. # If clicking the right answer = YOU WIN!
  51. # Wrong answer = YOU LOSE!
  52. # button_name.clicked.connect(function_name)
  53.  
  54. main_win.show()
  55. app.exec_()
  56.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement