Compare commits
2 Commits
6db74b04f5
...
dac83ccbf9
Author | SHA1 | Date |
---|---|---|
|
dac83ccbf9 | 2 months ago |
|
4d2b58b744 | 2 months ago |
11 changed files with 250 additions and 0 deletions
@ -0,0 +1,4 @@ |
|||||
|
# created by virtualenv automatically |
||||
|
bin |
||||
|
lib |
||||
|
|
@ -0,0 +1,30 @@ |
|||||
|
#! /usr/bin/python |
||||
|
#Datei: handleButton.py |
||||
|
|
||||
|
import sys |
||||
|
from PyQt6.QtWidgets import QApplication, QMainWindow, QPushButton |
||||
|
|
||||
|
|
||||
|
class MainWindow(QMainWindow): |
||||
|
def __init__(self): |
||||
|
super().__init__() |
||||
|
|
||||
|
self.setWindowTitle("Button Signal") |
||||
|
|
||||
|
button = QPushButton("Bitte klicken") |
||||
|
button.setCheckable(True) |
||||
|
button.clicked.connect(self.handle_button_click) |
||||
|
|
||||
|
# Set the central widget of the Window. |
||||
|
self.setCentralWidget(button) |
||||
|
|
||||
|
def handle_button_click(self): |
||||
|
print("Button geklickt") |
||||
|
|
||||
|
|
||||
|
app = QApplication(sys.argv) |
||||
|
|
||||
|
window = MainWindow() |
||||
|
window.show() |
||||
|
|
||||
|
app.exec() |
@ -0,0 +1,36 @@ |
|||||
|
#! /usr/bin/python |
||||
|
#Datei: lineEdit.py |
||||
|
|
||||
|
from PyQt6.QtWidgets import QApplication, QMainWindow, QLabel, QLineEdit, QVBoxLayout, QWidget |
||||
|
import sys |
||||
|
|
||||
|
|
||||
|
class MainWindow(QMainWindow): |
||||
|
def __init__(self): |
||||
|
super().__init__() |
||||
|
|
||||
|
self.setWindowTitle("Eingabe mit LineEdit") |
||||
|
|
||||
|
self.label = QLabel() |
||||
|
|
||||
|
self.input = QLineEdit() |
||||
|
self.input.textChanged.connect(self.label.setText) |
||||
|
|
||||
|
layout = QVBoxLayout() |
||||
|
layout.addWidget(self.input) |
||||
|
layout.addWidget(self.label) |
||||
|
|
||||
|
container = QWidget() |
||||
|
container.setLayout(layout) |
||||
|
|
||||
|
# Set the central widget of the Window. |
||||
|
self.setCentralWidget(container) |
||||
|
|
||||
|
|
||||
|
app = QApplication(sys.argv) |
||||
|
|
||||
|
window = MainWindow() |
||||
|
window.show() |
||||
|
|
||||
|
app.exec() |
||||
|
|
@ -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() |
||||
|
|
@ -0,0 +1,26 @@ |
|||||
|
#! /usr/bin/python |
||||
|
#Datei: mainwindows.py |
||||
|
import sys |
||||
|
|
||||
|
from PyQt6.QtCore import QSize, Qt |
||||
|
from PyQt6.QtWidgets import QApplication, QMainWindow, QPushButton |
||||
|
|
||||
|
|
||||
|
# Subclass QMainWindow to customize your application's main window |
||||
|
class MainWindow(QMainWindow): |
||||
|
def __init__(self): |
||||
|
super().__init__() |
||||
|
|
||||
|
self.setWindowTitle("My App") |
||||
|
button = QPushButton("Bitte klicken") |
||||
|
|
||||
|
# Set the central widget of the Window. |
||||
|
self.setCentralWidget(button) |
||||
|
|
||||
|
|
||||
|
app = QApplication(sys.argv) |
||||
|
|
||||
|
window = MainWindow() |
||||
|
window.show() |
||||
|
|
||||
|
app.exec() |
@ -0,0 +1,12 @@ |
|||||
|
#! /usr/bin/python |
||||
|
#Datei: pushbutton.py |
||||
|
|
||||
|
import sys |
||||
|
from PyQt6.QtWidgets import QApplication, QPushButton |
||||
|
|
||||
|
app = QApplication(sys.argv) |
||||
|
|
||||
|
window = QPushButton("Bitte klicken") |
||||
|
window.show() |
||||
|
|
||||
|
app.exec() |
@ -0,0 +1,8 @@ |
|||||
|
home = /usr/bin |
||||
|
implementation = CPython |
||||
|
version_info = 3.11.2.final.0 |
||||
|
virtualenv = 20.17.1+ds |
||||
|
include-system-site-packages = false |
||||
|
base-prefix = /usr |
||||
|
base-exec-prefix = /usr |
||||
|
base-executable = /usr/bin/python3 |
@ -0,0 +1,5 @@ |
|||||
|
numpy==2.2.3 |
||||
|
opencv-python==4.11.0.86 |
||||
|
PyQt6==6.8.1 |
||||
|
PyQt6-Qt6==6.8.2 |
||||
|
PyQt6_sip==13.10.0 |
@ -0,0 +1,30 @@ |
|||||
|
#! /usr/bin/python |
||||
|
# Datei: sizewindow.py |
||||
|
|
||||
|
import sys |
||||
|
from PyQt6.QtCore import QSize, Qt |
||||
|
from PyQt6.QtWidgets import QApplication, QMainWindow, QPushButton |
||||
|
|
||||
|
|
||||
|
# abgeleitet von QMainWindow können wir unser GUI besser einstellen und |
||||
|
# z.B. die Dimensionen des Fensters ändern. |
||||
|
class MainWindow(QMainWindow): |
||||
|
def __init__(self): |
||||
|
super().__init__() |
||||
|
|
||||
|
self.setWindowTitle("Fenstergröße") |
||||
|
|
||||
|
button = QPushButton("Bitte klicken") |
||||
|
|
||||
|
self.setFixedSize(QSize(400, 300)) |
||||
|
|
||||
|
# der Button sitzt als zentrales Widget im Fenster. |
||||
|
self.setCentralWidget(button) |
||||
|
|
||||
|
|
||||
|
app = QApplication(sys.argv) |
||||
|
|
||||
|
window = MainWindow() |
||||
|
window.show() |
||||
|
|
||||
|
app.exec() |
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,23 @@ |
|||||
|
#! /usr/bin/python |
||||
|
#Datei: window.py |
||||
|
|
||||
|
# Die benötigten Qt Widgets |
||||
|
from PyQt6.QtWidgets import QApplication, QWidget |
||||
|
|
||||
|
# Für die Kommandozeilenparameter |
||||
|
import sys |
||||
|
|
||||
|
# QTApplication instanziieren. Die Kommandozeilenparameter geben wir |
||||
|
# mit. |
||||
|
app = QApplication(sys.argv) |
||||
|
|
||||
|
# Window Widget erzeugen |
||||
|
window = QWidget() |
||||
|
window.show() # Das Fenster muss immer manuell angzeigt werden. |
||||
|
|
||||
|
# Wvent-Loop starten. |
||||
|
app.exec() |
||||
|
|
||||
|
|
||||
|
# So lang die Event-Loop läuft kommen wir hier nicht hin, |
||||
|
# sie kann durch den "Schließen" Button des Fensters unterbrochen werden. |
Loading…
Reference in new issue