Initial Commit
This commit is contained in:
20
1.py
Normal file
20
1.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
from PySide6.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class MainWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.setWindowTitle('my App')
|
||||||
|
button=QPushButton('Press me')
|
||||||
|
|
||||||
|
self.setMinimumSize(400,300)
|
||||||
|
|
||||||
|
self.setCentralWidget(button)
|
||||||
|
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
window = MainWindow()
|
||||||
|
window.show()
|
||||||
|
|
||||||
|
app.exec()
|
||||||
28
2.py
Normal file
28
2.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
from PySide6.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class MainWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.setWindowTitle('my App')
|
||||||
|
self.setMinimumSize(400,300)
|
||||||
|
|
||||||
|
button=QPushButton('Press me')
|
||||||
|
button.setCheckable(True)
|
||||||
|
button.clicked.connect(self.clicked)
|
||||||
|
button.clicked.connect(self.toggled)
|
||||||
|
self.setCentralWidget(button)
|
||||||
|
|
||||||
|
def clicked(self):
|
||||||
|
print('clicked')
|
||||||
|
|
||||||
|
def toggled(self, checked):
|
||||||
|
print('checked? ', checked)
|
||||||
|
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
window = MainWindow()
|
||||||
|
window.show()
|
||||||
|
|
||||||
|
app.exec()
|
||||||
31
2_1.py
Normal file
31
2_1.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
from PySide6.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class MainWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.is_checked = True
|
||||||
|
|
||||||
|
self.setWindowTitle('my App')
|
||||||
|
self.setMinimumSize(400,300)
|
||||||
|
|
||||||
|
button=QPushButton('Press me')
|
||||||
|
button.setCheckable(True)
|
||||||
|
button.clicked.connect(self.toggled)
|
||||||
|
button.setChecked(self.is_checked)
|
||||||
|
|
||||||
|
self.setCentralWidget(button)
|
||||||
|
|
||||||
|
|
||||||
|
def toggled(self, checked):
|
||||||
|
self.is_checked = checked
|
||||||
|
|
||||||
|
print(self.is_checked)
|
||||||
|
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
window = MainWindow()
|
||||||
|
window.show()
|
||||||
|
|
||||||
|
app.exec()
|
||||||
31
2_2.py
Normal file
31
2_2.py
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
from PySide6.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton, QLabel, QLineEdit, QHBoxLayout, \
|
||||||
|
QVBoxLayout
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class MainWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.setWindowTitle('my App')
|
||||||
|
self.setMinimumSize(400,300)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
self.setCentralWidget(container)
|
||||||
|
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
window = MainWindow()
|
||||||
|
window.show()
|
||||||
|
|
||||||
|
app.exec()
|
||||||
36
HC_Test.py
Normal file
36
HC_Test.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
from PySide6.QtWidgets import QApplication, QWidget, QMainWindow, QPushButton, QLabel, QLineEdit, QHBoxLayout, \
|
||||||
|
QVBoxLayout, QTextEdit
|
||||||
|
import sys
|
||||||
|
|
||||||
|
class MainWindow(QMainWindow):
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
|
||||||
|
self.setWindowTitle('my App')
|
||||||
|
self.setMinimumSize(400,300)
|
||||||
|
|
||||||
|
self.input=QTextEdit()
|
||||||
|
|
||||||
|
self.button = QPushButton('Submit')
|
||||||
|
self.button.connect(self.testSubmit)
|
||||||
|
|
||||||
|
layout=QVBoxLayout()
|
||||||
|
layout.addWidget(self.input)
|
||||||
|
layout.addWidget(self.button)
|
||||||
|
|
||||||
|
|
||||||
|
container=QWidget()
|
||||||
|
container.setLayout(layout)
|
||||||
|
|
||||||
|
self.setCentralWidget(container)
|
||||||
|
|
||||||
|
def testSubmit(self):
|
||||||
|
values = self.input.toPlainText()
|
||||||
|
print(values)
|
||||||
|
|
||||||
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
window = MainWindow()
|
||||||
|
window.show()
|
||||||
|
|
||||||
|
app.exec()
|
||||||
Reference in New Issue
Block a user