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
@eyllanesc
eyllanesc / CheckBoxExample.py
Last active July 16, 2017 18:29
CheckBoxExample
import sys
from PyQt5.QtWidgets import QWidget, QApplication, QVBoxLayout, QCheckBox, QLineEdit
from functools import partial
class Widget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setLayout(QVBoxLayout())
self.le = QLineEdit(self)
import sys, time
from PyQt4 import QtGui, QtCore
class Window(QtGui.QMainWindow):
def __init__(self):
super(Window, self).__init__()
self.setGeometry(50, 50, 500, 200)
self.setWindowTitle("TEST APP!")
self.field_dict = {}
self.home()
class Stadium(QWidget):
def __init__(self, pixmap, parent=None):
QWidget.__init__(self, parent=parent)
self.pixmap = pixmap
self.pos = None
self.setMouseTracking(True)
def paintEvent(self, event):
painter = QPainter(self)
w = min(1.0*self.width()/self.pixmap.width(), 1.0*self.height()/self.pixmap.height())
@eyllanesc
eyllanesc / main.py
Last active July 28, 2017 15:24
PyQt5 Dynamically add rectangles to QML grid
from PyQt5.QtGui import QGuiApplication, QColor
from PyQt5.QtQml import QQmlApplicationEngine, QQmlComponent
from PyQt5.QtCore import QUrl, Qt, QCoreApplication, QAbstractListModel, QModelIndex, QTimer, qsrand, qrand, QTime
from PyQt5.QtQuick import QQuickItem
class Data(object):
def __init__(self, width=35, height=35, color=QColor("red")):
self._width = width
self._height = height
self._color = color
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
import sys
app = QApplication(sys.argv)
w = QWidget()
w.setLayout(QVBoxLayout())
skillP = QCheckBox("Passive")
skillCb = QCheckBox("Combat")
skillCm = QCheckBox("Command")
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
import sys
class Widget(QWidget):
def __init__(self, parent=None):
QWidget.__init__(self, parent)
self.setLayout(QVBoxLayout())
self.le = QLineEdit(":P", self)
@eyllanesc
eyllanesc / QLABEL2.py
Last active August 8, 2017 20:02
QLabel_alterada
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
class QLabel_alterada(QLabel):
clicked=pyqtSignal()
def __init__(self, parent=None):
QLabel.__init__(self, parent)
print("test")
@eyllanesc
eyllanesc / Plotter.py
Last active August 8, 2017 23:23
Plotter
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
from PyQt5.QtCore import QRegularExpression, pyqtSignal
from PyQt5.QtGui import QIcon, QRegularExpressionValidator, QValidator
from PyQt5.QtWidgets import QTableWidget, QApplication, QTableWidgetItem, QMenu, QInputDialog, QLineEdit, QMainWindow, \
QDialog, QVBoxLayout, QLabel, QHBoxLayout, QComboBox, QToolButton, QPushButton, QSpacerItem, QSizePolicy, \
QWidget, QFileDialog, QDialogButtonBox
@eyllanesc
eyllanesc / LedWidget.py
Last active August 13, 2017 01:03
Promoted Widgets
from PyQt5.QtCore import QSize, Qt
from PyQt5.QtGui import QPainter, QColor
from PyQt5.QtWidgets import QLabel, QWidget, QVBoxLayout, QApplication
class Led(QWidget):
def __init__(self, colorOn, colorOff, parent=None):
QLabel.__init__(self, parent)
self.colorOn = colorOn
self.colorOff = colorOff
@eyllanesc
eyllanesc / Elements.py
Created August 13, 2017 19:27
You have to enable the ItemIsSelectable flag: self.setFlag(QGraphicsItem.ItemIsSelectable, True)
from PySide.QtCore import *
from PySide.QtGui import *
rad = 5
class WindowClass(QMainWindow):
def __init__(self):
super(WindowClass, self).__init__()
self.view = ViewClass()