Skip to content

Instantly share code, notes, and snippets.

View eyllanesc's full-sized avatar
:octocat:
I may be slow to respond.

Edwin Yllanes eyllanesc

:octocat:
I may be slow to respond.
View GitHub Profile
import random
from PyQt5 import QtCore, QtGui, QtWidgets
class FlowLayout(QtWidgets.QLayout):
def __init__(self, parent=None, margin=-1, hspacing=-1, vspacing=-1):
super(FlowLayout, self).__init__(parent)
self._hspacing = hspacing
self._vspacing = vspacing
self._items = []
self.setContentsMargins(margin, margin, margin, margin)
from PyQt5 import QtCore, QtWidgets
import queue
import threading
import pyqtgraph as pg
import numpy as np
class App(QtWidgets.QMainWindow):
def __init__(self):
super(App, self).__init__()
self.initUI()
import sys
from PyQt4 import QtCore, QtGui, QtWebKit
class Widget(QtGui.QWidget):
def __init__(self, parent=None):
super(Widget, self).__init__(parent)
vlay = QtGui.QVBoxLayout(self)
self.le = QtGui.QLineEdit()
self.browser = QtWebKit.QWebView()
self.le.returnPressed.connect(self._return_pressed)
@eyllanesc
eyllanesc / main.py
Created November 14, 2018 16:04
53288877
import sys
import time
import logging
import multiprocessing
import threading
from PySide2 import QtCore, QtWidgets
def long_task():
logging.info('Starting long task')
time.sleep(3) # this would be replaced with a real task
@eyllanesc
eyllanesc / main.py
Last active November 2, 2018 18:49
Example 53122557
from PyQt5 import QtWidgets
class Dialog(QtWidgets.QDialog):
def __init__(self, parent=None):
super(Dialog, self).__init__(parent=None)
self.user_le = QtWidgets.QLineEdit()
self.pass_le = QtWidgets.QLineEdit(echoMode=QtWidgets.QLineEdit.Password)
buttonBox = QtWidgets.QDialogButtonBox()
buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
from PyQt5 import QtCore, QtGui, QtWidgets
class PixmapItem(QtWidgets.QGraphicsPixmapItem):
def __init__(self, parent=None):
super().__init__(parent)
self.setAcceptDrops(True)
self.setPixmap(QtGui.QPixmap('hold.png'))
self.setCursor(QtCore.Qt.OpenHandCursor)
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, True)
#include <QApplication>
#include <QTableView>
#include <QDebug>
#include <QStandardItemModel>
class MyEventReceiver: public QObject{
public:
using QObject::QObject;
public slots:
void onClick(const QModelIndex & index){
from PySide2.QtCore import Property, QObject, Signal, QCoreApplication, QTimer
class QtProperty(Property):
def __init__(self, value, name='', type_=None, notify=None):
if type_ and notify:
super().__init__(type_, self.getter, self.setter, notify=notify)
self.value = value
self.name = name
def getter(self, inst=None):
@eyllanesc
eyllanesc / main.py
Created July 24, 2018 11:51
test.py
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
class PicButton(QAbstractButton):
def __init__(self, pixmap, parent=None):
super(PicButton, self).__init__(parent)
self.pixmap = pixmap
@eyllanesc
eyllanesc / main.py
Created July 18, 2018 18:03
proof concept
import sys
from random import randint
from PyQt5 import QtCore, QtGui, QtWidgets, QtChart
class Widget(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(Widget, self).__init__(parent)