Dateien zu Teil 29
This commit is contained in:
76
teil29/login.py
Executable file
76
teil29/login.py
Executable file
@@ -0,0 +1,76 @@
|
||||
#! /usr/bin/python
|
||||
#Datei: lineEdit.py
|
||||
|
||||
from PyQt6.QtWidgets import QApplication, QMainWindow, QLabel, QLineEdit, QPushButton, QGridLayout, QWidget
|
||||
from PyQt6.QtGui import QPixmap
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
class MainWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
self.setWindowTitle("Login")
|
||||
|
||||
layout = QGridLayout()
|
||||
layout.setContentsMargins(20, 20, 20, 20)
|
||||
layout.setSpacing(10)
|
||||
|
||||
self.user_logo_pixmap =QPixmap('./user.jpg')
|
||||
self.user_logo_label = QLabel()
|
||||
self.user_logo_label.setPixmap(self.user_logo_pixmap)
|
||||
|
||||
layout.addWidget(self.user_logo_label,1,1)
|
||||
|
||||
|
||||
|
||||
self.user_label = QLabel('Username:')
|
||||
self.password_label = QLabel('Passwort:')
|
||||
self.username_input = QLineEdit()
|
||||
self.password_input = QLineEdit()
|
||||
self.password_input.setEchoMode(QLineEdit.EchoMode.Password)
|
||||
|
||||
layout.addWidget(self.user_label,2,0)
|
||||
layout.addWidget(self.username_input,2,1,1,2)
|
||||
|
||||
layout.addWidget(self.password_label,3,0)
|
||||
layout.addWidget(self.password_input,3,1,1,2)
|
||||
|
||||
#Buttons
|
||||
self.register_button = QPushButton("Register")
|
||||
layout.addWidget(self.register_button, 4, 1)
|
||||
|
||||
self.login_button = QPushButton("Login")
|
||||
self.login_button.clicked.connect(self.handle_login_button)
|
||||
self.register_button.clicked.connect(self.handle_register_button)
|
||||
|
||||
layout.addWidget(self.login_button, 4, 2)
|
||||
|
||||
# Password vergessen
|
||||
self.forgot_pw_label = QLabel()
|
||||
|
||||
self.forgot_pw_label.setText('https://test.com/forgotpw')
|
||||
layout.addWidget(self.forgot_pw_label,5,1)
|
||||
container = QWidget()
|
||||
container.setLayout(layout)
|
||||
|
||||
# Set the central widget of the Window.
|
||||
self.setCentralWidget(container)
|
||||
|
||||
def handle_register_button(self):
|
||||
print('Register Button')
|
||||
|
||||
def handle_login_button(self):
|
||||
print(f'Login mit {self.username_input.text()} and {self.password_input.text()}')
|
||||
|
||||
|
||||
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
window = MainWindow()
|
||||
window.show()
|
||||
|
||||
app.exec()
|
||||
|
Reference in New Issue
Block a user