This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import (QApplication, QWidget, QPushButton, QLabel, QLineEdit, QGridLayout, QMessageBox) | |
class LoginForm(QWidget): | |
def __init__(self): | |
super().__init__() | |
self.setWindowTitle('Login Form') | |
self.resize(500, 120) | |
layout = QGridLayout() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
myFile = 'a file.txt' | |
def dir_check(input_dir): | |
if os.path.isdir(input_dir): | |
print(input_dir + ' is a folder') | |
return 1 | |
elif os.path.isfile(input_dir): | |
print(input_dir + ' is a file') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
for item in os.listdir(os.getcwd()): | |
if os.path.isdir(item): | |
if not os.listdir(item): | |
print(os.path.join(os.getcwd(), item)) | |
os.removedirs(os.path.join(os.getcwd(), item)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import (QApplication, QWidget) | |
from PyQt5.QtGui import QColor, QPainter | |
from PyQt5.QtCore import Qt, QRect, QPoint, QTimer | |
class AppDemo(QWidget): | |
def __init__(self): | |
super().__init__() | |
self.resize(1200, 800) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import (QApplication, QWidget, QCalendarWidget, QDial, QVBoxLayout) | |
from PyQt5.QtCore import QDate | |
class MainWindow(QWidget): | |
def __init__(self): | |
super().__init__() | |
self.resize(700, 500) | |
self.dial = QDial() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import (QApplication, QWidget, QMdiArea, QCalendarWidget, QTextEdit, QPushButton) | |
class AppDemo(QWidget): | |
def __init__(self): | |
super().__init__() | |
self.resize(800, 800) | |
workspace = QMdiArea(self) | |
workspace.resize(self.rect().width(), self.rect().height()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import (QApplication, QWidget, QDial, QSpinBox) | |
from PyQt5.QtGui import QFont | |
class MainWindow(QWidget): | |
def __init__(self): | |
super().__init__() | |
self.resize(400, 300) | |
f = QFont('', 16) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import (QApplication, QWidget, QMessageBox) | |
class MainWindow(QWidget): | |
def __init__(self): | |
super().__init__() | |
def closeEvent(self, event): | |
reply = QMessageBox.question(self, 'Window Close', 'Are you sure you want to close the window?', | |
QMessageBox.Yes | QMessageBox.No, QMessageBox.No) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from PyQt5.QtWidgets import (QApplication, QWidget) | |
from PyQt5.Qt import Qt | |
class MainWindow(QWidget): | |
def __init__(self): | |
super().__init__() | |
def keyPressEvent(self, event): | |
if event.key() == Qt.Key_Space: |