Skip to content

Instantly share code, notes, and snippets.

@WEBMAMOFFICE
Last active August 17, 2021 10:06
Show Gist options
  • Save WEBMAMOFFICE/a758c1e831c3aa84e8087820ff16b2c6 to your computer and use it in GitHub Desktop.
Save WEBMAMOFFICE/a758c1e831c3aa84e8087820ff16b2c6 to your computer and use it in GitHub Desktop.

Revisions

  1. WEBMAMOFFICE revised this gist Apr 18, 2018. 1 changed file with 17 additions and 13 deletions.
    30 changes: 17 additions & 13 deletions pyqt_app1.py
    Original file line number Diff line number Diff line change
    @@ -10,16 +10,20 @@ class PushBut1(QtWidgets.QPushButton):
    def __init__(self, parent=None):
    super(PushBut1, self).__init__(parent)
    self.setMouseTracking(True)
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,0,100); color: rgba(1,140,0,100); border-style: solid;"
    "border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,255,100); color: rgba(0,190,255,255); border-style: solid;"
    "border-radius: 3px; border-width: 0.5px; border-color: rgba(127,127,255,255);")

    def enterEvent(self, event):
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,140,040,100); color: rgba(1,140,255,100);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,140,100);")
    if self.isEnabled() is True:
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,255,100); color: rgba(0,230,255,255);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(0,230,255,255);")
    if self.isEnabled() is False:
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,255,100); color: rgba(0,190,255,255); border-style: solid;"
    "border-radius: 3px; border-width: 0.5px; border-color: rgba(127,127,255,255);")

    def leaveEvent(self, event):
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,0,100); color: rgba(1,140,0,100); border-style: solid;"
    "border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,255,100); color: rgba(0,190,255,255); border-style: solid;"
    "border-radius: 3px; border-width: 0.5px; border-color: rgba(127,127,255,255);")


    class PyQtApp(QtWidgets.QWidget):
    @@ -30,13 +34,13 @@ def __init__(self, parent=None):
    self.setWindowIcon(QtGui.QIcon("Path/to/Your/image/file.png"))
    self.setMinimumWidth(resolution.width() / 3)
    self.setMinimumHeight(resolution.height() / 1.5)
    self.setStyleSheet("QWidget {background-color: rgba(1,255,0,100);} QScrollBar:horizontal {width: 1px; height: 1px;"
    "background-color: rgba(0,140,0,255);} QScrollBar:vertical {width: 1px; height: 1px;"
    "background-color: rgba(0,140,0,255);}")
    self.setStyleSheet("QWidget {background-color: rgba(0,41,59,255);} QScrollBar:horizontal {width: 1px; height: 1px;"
    "background-color: rgba(0,41,59,255);} QScrollBar:vertical {width: 1px; height: 1px;"
    "background-color: rgba(0,41,59,255);}")
    self.textf = QtWidgets.QTextEdit(self)
    self.textf.setPlaceholderText("Results...")
    self.textf.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,0,100); color: rgba(1,140,0,100);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")
    self.textf.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(0,255,255,100); color: rgba(0,190,255,255);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(0,140,255,255);")
    self.but1 = PushBut1(self)
    self.but1.setText("")
    self.but1.setFixedWidth(72)
    @@ -84,8 +88,8 @@ def __init__(self, parent=None):
    self.but2.clicked.connect(self.on_but2)

    def on_but1(self):
    self.textf.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,140,0,100); color: rgba(1,255,255,100);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")
    self.textf.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,217,100); color: rgba(0,190,255,255);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(0,140,255,255);")

    def on_but2(self):
    txt = self.textf.toPlainText()
  2. WEBMAMOFFICE revised this gist Mar 21, 2018. 1 changed file with 13 additions and 0 deletions.
    13 changes: 13 additions & 0 deletions pyqt_app1.py
    Original file line number Diff line number Diff line change
    @@ -65,6 +65,9 @@ def __init__(self, parent=None):
    self.but7.setText("")
    self.but7.setFixedWidth(72)
    self.but7.setFont(font_but)
    self.lb1 = QtWidgets.QLabel(self)
    self.lb1.setFixedWidth(72)
    self.lb1.setFixedHeight(72)
    self.grid1 = QtWidgets.QGridLayout()
    self.grid1.addWidget(self.textf, 0, 0, 14, 13)
    self.grid1.addWidget(self.but1, 0, 14, 1, 1)
    @@ -74,13 +77,23 @@ def __init__(self, parent=None):
    self.grid1.addWidget(self.but5, 4, 14, 1, 1)
    self.grid1.addWidget(self.but6, 5, 14, 1, 1)
    self.grid1.addWidget(self.but7, 6, 14, 1, 1)
    self.grid1.addWidget(self.lb1, 12, 14, 1, 1)
    self.grid1.setContentsMargins(7, 7, 7, 7)
    self.setLayout(self.grid1)
    self.but1.clicked.connect(self.on_but1)
    self.but2.clicked.connect(self.on_but2)

    def on_but1(self):
    self.textf.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,140,0,100); color: rgba(1,255,255,100);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")

    def on_but2(self):
    txt = self.textf.toPlainText()
    try:
    img = QtGui.QPixmap(txt)
    self.lb1.setPixmap(img.scaledToWidth(72, QtCore.Qt.SmoothTransformation))
    except:
    pass


    if __name__ == "__main__":
  3. WEBMAMOFFICE revised this gist Mar 21, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions pyqt_app1.py
    Original file line number Diff line number Diff line change
    @@ -76,6 +76,7 @@ def __init__(self, parent=None):
    self.grid1.addWidget(self.but7, 6, 14, 1, 1)
    self.grid1.setContentsMargins(7, 7, 7, 7)
    self.setLayout(self.grid1)
    self.but1.clicked.connect(self.on_but1)

    def on_but1(self):
    self.textf.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,140,0,100); color: rgba(1,255,255,100);"
  4. WEBMAMOFFICE revised this gist Mar 21, 2018. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion pyqt_app1.py
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,11 @@ def __init__(self, parent=None):
    self.grid1.addWidget(self.but7, 6, 14, 1, 1)
    self.grid1.setContentsMargins(7, 7, 7, 7)
    self.setLayout(self.grid1)


    def on_but1(self):
    self.textf.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,140,0,100); color: rgba(1,255,255,100);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")


    if __name__ == "__main__":
    import sys
  5. WEBMAMOFFICE revised this gist Mar 21, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pyqt_app1.py
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,7 @@ def __init__(self, parent=None):
    self.setStyleSheet("QWidget {background-color: rgba(1,255,0,100);} QScrollBar:horizontal {width: 1px; height: 1px;"
    "background-color: rgba(0,140,0,255);} QScrollBar:vertical {width: 1px; height: 1px;"
    "background-color: rgba(0,140,0,255);}")
    self.textf = QtWidgets.QTextEdit(self)
    self.textf = QtWidgets.QTextEdit(self)
    self.textf.setPlaceholderText("Results...")
    self.textf.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,0,100); color: rgba(1,140,0,100);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")
  6. WEBMAMOFFICE revised this gist Mar 21, 2018. 1 changed file with 64 additions and 0 deletions.
    64 changes: 64 additions & 0 deletions pyqt_app1.py
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,26 @@
    from PyQt5 import QtWidgets, QtGui, QtCore

    font_but = QtGui.QFont()
    font_but.setFamily("Segoe UI Symbol")
    font_but.setPointSize(10)
    font_but.setWeight(95)


    class PushBut1(QtWidgets.QPushButton):
    def __init__(self, parent=None):
    super(PushBut1, self).__init__(parent)
    self.setMouseTracking(True)
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,0,100); color: rgba(1,140,0,100); border-style: solid;"
    "border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")

    def enterEvent(self, event):
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,140,040,100); color: rgba(1,140,255,100);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,140,100);")

    def leaveEvent(self, event):
    self.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,0,100); color: rgba(1,140,0,100); border-style: solid;"
    "border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")


    class PyQtApp(QtWidgets.QWidget):

    @@ -12,6 +33,49 @@ def __init__(self, parent=None):
    self.setStyleSheet("QWidget {background-color: rgba(1,255,0,100);} QScrollBar:horizontal {width: 1px; height: 1px;"
    "background-color: rgba(0,140,0,255);} QScrollBar:vertical {width: 1px; height: 1px;"
    "background-color: rgba(0,140,0,255);}")
    self.textf = QtWidgets.QTextEdit(self)
    self.textf.setPlaceholderText("Results...")
    self.textf.setStyleSheet("margin: 1px; padding: 7px; background-color: rgba(1,255,0,100); color: rgba(1,140,0,100);"
    "border-style: solid; border-radius: 3px; border-width: 0.5px; border-color: rgba(1,140,0,100);")
    self.but1 = PushBut1(self)
    self.but1.setText("")
    self.but1.setFixedWidth(72)
    self.but1.setFont(font_but)
    self.but2 = PushBut1(self)
    self.but2.setText("")
    self.but2.setFixedWidth(72)
    self.but2.setFont(font_but)
    self.but3 = PushBut1(self)
    self.but3.setText("")
    self.but3.setFixedWidth(72)
    self.but3.setFont(font_but)
    self.but4 = PushBut1(self)
    self.but4.setText("")
    self.but4.setFixedWidth(72)
    self.but4.setFont(font_but)
    self.but5 = PushBut1(self)
    self.but5.setText("")
    self.but5.setFixedWidth(72)
    self.but5.setFont(font_but)
    self.but6 = PushBut1(self)
    self.but6.setText("")
    self.but6.setFixedWidth(72)
    self.but6.setFont(font_but)
    self.but7 = PushBut1(self)
    self.but7.setText("")
    self.but7.setFixedWidth(72)
    self.but7.setFont(font_but)
    self.grid1 = QtWidgets.QGridLayout()
    self.grid1.addWidget(self.textf, 0, 0, 14, 13)
    self.grid1.addWidget(self.but1, 0, 14, 1, 1)
    self.grid1.addWidget(self.but2, 1, 14, 1, 1)
    self.grid1.addWidget(self.but3, 2, 14, 1, 1)
    self.grid1.addWidget(self.but4, 3, 14, 1, 1)
    self.grid1.addWidget(self.but5, 4, 14, 1, 1)
    self.grid1.addWidget(self.but6, 5, 14, 1, 1)
    self.grid1.addWidget(self.but7, 6, 14, 1, 1)
    self.grid1.setContentsMargins(7, 7, 7, 7)
    self.setLayout(self.grid1)


    if __name__ == "__main__":
  7. WEBMAMOFFICE revised this gist Mar 21, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion pyqt_app1.py
    Original file line number Diff line number Diff line change
    @@ -26,4 +26,5 @@ def __init__(self, parent=None):
    sys.exit(app.exec_())
    else:
    desktop = QtWidgets.QApplication.desktop()
    resolution = desktop.availableGeometry()
    resolution = desktop.availableGeometry()

  8. WEBMAMOFFICE created this gist Mar 21, 2018.
    29 changes: 29 additions & 0 deletions pyqt_app1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    from PyQt5 import QtWidgets, QtGui, QtCore


    class PyQtApp(QtWidgets.QWidget):

    def __init__(self, parent=None):
    QtWidgets.QWidget.__init__(self, parent)
    self.setWindowTitle("PyQt Application")
    self.setWindowIcon(QtGui.QIcon("Path/to/Your/image/file.png"))
    self.setMinimumWidth(resolution.width() / 3)
    self.setMinimumHeight(resolution.height() / 1.5)
    self.setStyleSheet("QWidget {background-color: rgba(1,255,0,100);} QScrollBar:horizontal {width: 1px; height: 1px;"
    "background-color: rgba(0,140,0,255);} QScrollBar:vertical {width: 1px; height: 1px;"
    "background-color: rgba(0,140,0,255);}")


    if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    desktop = QtWidgets.QApplication.desktop()
    resolution = desktop.availableGeometry()
    myapp = PyQtApp()
    myapp.setWindowOpacity(0.95)
    myapp.show()
    myapp.move(resolution.center() - myapp.rect().center())
    sys.exit(app.exec_())
    else:
    desktop = QtWidgets.QApplication.desktop()
    resolution = desktop.availableGeometry()