Skip to content

Instantly share code, notes, and snippets.

@saleph
saleph / slider.py
Created August 26, 2015 18:10
[qt5] slot & signal - slider
__author__ = 'tom'
import sys
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (QWidget, QLCDNumber, QSlider,
QVBoxLayout, QApplication)
class Example(QWidget):
def __init__(self):
@saleph
saleph / grid_layout_advanced.py
Created August 26, 2015 15:30
[qt5] grid layout - review edit
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import (QWidget, QLabel, QLineEdit,
QTextEdit, QGridLayout, QApplication)
class Example(QWidget):
def __init__(self):
super().__init__()
@saleph
saleph / grid_layout.py
Created August 26, 2015 15:13
[qt5] grid layout - calculator skeleton
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import (QWidget, QGridLayout,
QPushButton, QApplication)
class Example(QWidget):
def __init__(self):
super().__init__()
@saleph
saleph / boxlayout.py
Created August 26, 2015 14:50
[qt5] box layout
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import (QWidget, QPushButton,
QHBoxLayout, QVBoxLayout, QApplication)
class Example(QWidget):
def __init__(self):
super().__init__()
@saleph
saleph / simple_gui.py
Created August 26, 2015 14:17
[qt5] text area + tool-, status- & menubar
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import QMainWindow, QTextEdit, QAction, QApplication
from PyQt5.QtGui import QIcon
class Example(QMainWindow):
def __init__(self):
super().__init__()
@saleph
saleph / toolbar.py
Created August 26, 2015 13:58
[qt5] toolbar
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication
from PyQt5.QtGui import QIcon
class Example(QMainWindow):
def __init__(self):
super().__init__()
@saleph
saleph / menubar.py
Created August 26, 2015 12:46
[qt5] menubar + tip in statusbar
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import QMainWindow, QAction, qApp, QApplication
from PyQt5.QtGui import QIcon
class Example(QMainWindow):
def __init__(self):
super().__init__()
@saleph
saleph / statusbar.py
Last active August 26, 2015 12:47
[qt5] window's statusbar
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import QMainWindow, QApplication
class Example(QMainWindow):
def __init__(self):
super().__init__()
self.init_ui()
@saleph
saleph / centering.py
Last active August 8, 2022 05:20
[qt5] center a window on screen
__author__ = 'tom'
import sys
from PyQt5.QtWidgets import QWidget, QDesktopWidget, QApplication
class Example(QWidget):
def __init__(self):
super().__init__()
self.init_ui()
@saleph
saleph / msgbox.py
Last active November 3, 2019 13:09
[qt5] handling close event - msg box
__author__ = "tom"
import sys
from PyQt5.QtWidgets import QWidget, QMessageBox, QApplication
class Example(QWidget):
def __init__(self):
super().__init__()
self.init_ui()