You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
2.0 KiB
78 lines
2.0 KiB
#! /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_button = QPushButton('Passwort vergessen')
|
|
self.forgot_pw_button.setStyleSheet('QPushButton {background-color: #A3C1DA; color: blue;}')
|
|
layout.addWidget(self.forgot_pw_button,5,2)
|
|
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()}')
|
|
|
|
def handle_forgot_pw_button(self):
|
|
print('Forgot PW')
|
|
|
|
|
|
|
|
|
|
app = QApplication(sys.argv)
|
|
|
|
window = MainWindow()
|
|
window.show()
|
|
|
|
app.exec()
|
|
|
|
|