This file contains hidden or 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
| class Example(QWidget): | |
| def __init__(self): | |
| super(Example, self).__init__() | |
| self.initUI() | |
| def initUI(self): | |
| grid = QGridLayout() | |
| self.setLayout(grid) |
This file contains hidden or 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
| rom PyQt5.QtWidgets import * | |
| from PyQt5 import QtCore | |
| from PyQt5.QtGui import * | |
| import sys | |
| class Window(QMainWindow): | |
| def __init__(self): | |
| super().__init__() | |
This file contains hidden or 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 random | |
| import sys | |
| from PyQt5 import QtGui, QtWidgets | |
| if __name__ == "__main__": | |
| app = QtWidgets.QApplication(sys.argv) | |
| w = QtWidgets.QWidget() | |
| glay = QtWidgets.QGridLayout(w) | |
| for i in range(3): |
This file contains hidden or 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
| myFont=QtGui.QFont() | |
| myFont.setBold(True) | |
| self.label.setFont(myFont) |
This file contains hidden or 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 matplotlib.pyplot as plt | |
| plt.plot([1, 2, 3, 4], [1, 4, 9, 16]) | |
| plt.xlabel('X-Label') | |
| plt.ylabel('Y-Label') | |
| plt.axis([0, 5, 0, 20]) | |
| plt.show() |
This file contains hidden or 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 random | |
| import matplotlib.pyplot as plt | |
| x = range(1, 101) | |
| y1 = [random.randint(1, 100) for _ in range(len(x))] | |
| y2 = [random.randint(1, 100) for _ in range(len(x))] | |
| fig = plt.figure() | |
| ax = fig.add_subplot(111) # The big subplot | |
| ax1 = fig.add_subplot(211) |
This file contains hidden or 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
| while (self.tableFriends.rowCount() > 0): | |
| { | |
| self.tableFriends.removeRow(0) | |
| } | |
| #You can also try: | |
| tableFriends.setRowCount(0) |
This file contains hidden or 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
| class SurfViewer(QMainWindow): | |
| def __init__(self, parent=None): | |
| super(SurfViewer, self).__init__(parent=parent) | |
| self.setFixedSize(300, 100) | |
| self.wid = QWidget() | |
| self.setCentralWidget(self.wid) | |
| self.groups = QHBoxLayout(self.wid) |
This file contains hidden or 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, QInputDialog, QLineEdit | |
| from PyQt5.QtGui import QIcon | |
| class App(QWidget): | |
| def __init__(self): | |
| super().__init__() | |
| self.title = 'PyQt5 input dialogs - pythonspot.com' |
OlderNewer