from PyQt5.QtWidgets import *
def __init__(self):
self.window.setGeometry(50, 50, 350, 200)
self.window.setWindowTitle("Fantasy F1")
self.UserOrNot()
self.window.show()
def UserOrNot(self):
self.
UserQuestion = QLabel("Are you an existing user or a new user?") self.layout.addWidget(self.UserQuestion)
## creates a button for existing users
self.layout.addWidget(self.ExistingUser)
## creates a button for new users
self.NewUser.clicked.connect(NewUserPressed)
self.layout.addWidget(self.NewUser)
self.window.setLayout(self.layout)
# self.window.show()
def NewUserPressed():
print("button pressed")
main = CreateUser()
def __init__(self):
self.window.setGeometry(50, 50, 350, 250)
self.window.setWindowTitle("Create a team")
self.CreateUserForm()
def CreateUserForm(self):
self.layout = QFormLayout()
## creates a form (age is spinbox to make sure user can only enter numbers)
self.
layout.
addRow(QLabel("Those with a * must be filled in."))
self.layout.addWidget(self.OKButton)
self.layout.addWidget(self.CancelButton)
self.window.setLayout(self.layout)
self.window.show()
if __name__ == '__main__':
import sys
main = StartScreen()
sys.exit(app.exec_())
from PyQt5.QtWidgets import *
class StartScreen(QWidget):
def __init__(self):
self.window = QWidget()
self.window.setGeometry(50, 50, 350, 200)
self.window.setWindowTitle("Fantasy F1")
self.UserOrNot()
self.window.show()
def UserOrNot(self):
self.layout = QGridLayout()
self.UserQuestion = QLabel("Are you an existing user or a new user?")
self.layout.addWidget(self.UserQuestion)
## creates a button for existing users
self.ExistingUser = QPushButton("Existing user")
self.layout.addWidget(self.ExistingUser)
## creates a button for new users
self.NewUser = QPushButton("New user")
self.NewUser.clicked.connect(NewUserPressed)
self.layout.addWidget(self.NewUser)
self.window.setLayout(self.layout)
# self.window.show()
def NewUserPressed():
print("button pressed")
main = CreateUser()
class CreateUser(QWidget):
def __init__(self):
self.window = QWidget()
self.window.setGeometry(50, 50, 350, 250)
self.window.setWindowTitle("Create a team")
self.CreateUserForm()
def CreateUserForm(self):
self.layout = QFormLayout()
## creates a form (age is spinbox to make sure user can only enter numbers)
self.layout.addRow(QLabel("*Username:"), QLineEdit())
self.layout.addRow(QLabel("*Team name:"), QLineEdit())
self.layout.addRow(QLabel("*First name:"), QLineEdit())
self.layout.addRow(QLabel("*Last name:"), QLineEdit())
self.layout.addRow(QLabel("*Password:"), QLineEdit())
self.layout.addRow(QLabel("Email address:"), QLineEdit())
self.layout.addRow(QLabel("Age:"), QSpinBox())
self.layout.addRow(QLabel("Those with a * must be filled in."))
self.OKButton = QPushButton("OK")
self.layout.addWidget(self.OKButton)
self.CancelButton = QPushButton("Cancel")
self.layout.addWidget(self.CancelButton)
self.window.setLayout(self.layout)
self.window.show()
if __name__ == '__main__':
import sys
app = QApplication(sys.argv)
main = StartScreen()
sys.exit(app.exec_())
To copy to clipboard, switch view to plain text mode
Bookmarks