# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QVBoxLayout,QMainWindow, QAction, qApp
# from PyQt5.QtCore import QCoreApplication
# import random
# class rps():
# def btn1_click(self):
# print("you played rock.")
# np=random.randint(0,2)
# up=0
# print("Computer vs user :", end=" ")
# if np == 0:
# print("rock vs", end=" ")
# elif np == 1:
# print("paper vs", end=" ")
# elif np == 2:
# print("scissors vs", end=" ")
# print("rock >>", end=" ")
# if np==up:
# print("Tie")
# elif np==1:
# print("Computer win")
# else:
# print("User win")
# def btn2_click(self):
# print("you played paper.")
# np=random.randint(0,2)
# up=1
# print("Computer vs user :", end=" ")
# if np == 0:
# print("rock vs", end=" ")
# elif np == 1:
# print("paper vs", end=" ")
# elif np == 2:
# print("scissors vs", end=" ")
# print("paper >>", end=" ")
# if np==up:
# print("Tie")
# elif np==2:
# print("Computer win")
# else:
# print("User win")
# def btn3_click(self):
# print("you played scissors.")
# np=random.randint(0,2)
# up=2
# print("Computer vs user :", end=" ")
# if np == 0:
# print("rock vs", end=" ")
# elif np == 1:
# print("paper vs", end=" ")
# elif np == 2:
# print("scissors vs", end=" ")
# print("scissors >>", end=" ")
# if np==up:
# print("Tie")
# elif np==0:
# print("Computer win")
# else:
# print("User win")
#
# class MyApp(QWidget):
#
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
#
# btn1 = QPushButton('&Rock', self)
# btn1.setToolTip('Press to play <b>Rock</b>')
# btn2 = QPushButton(self)
# btn2.setText('&Paper')
# btn2.setToolTip('Press to play <b>Paper</b>')
# btn3 = QPushButton('&scissors', self)
# btn3.setToolTip('Press to play <b>Scissors</b>')
#
# vbox = QVBoxLayout()
# vbox.addWidget(btn1)
# vbox.addWidget(btn2)
# vbox.addWidget(btn3)
# btn1.clicked.connect(lambda:rps.btn1_click(self))
# btn2.clicked.connect(lambda: rps.btn2_click(self))
# btn3.clicked.connect(lambda: rps.btn3_click(self))
# btn1.setStyleSheet("color: Blue;"
# "background-color: #FF0000")
# btn2.setStyleSheet("color: Purple;"
# "background-color: #FFFF00")
# btn3.setStyleSheet("color: Orange;"
# "background-color: #0000FF")
# self.setLayout(vbox)
# self.setWindowTitle('Rock paper scissors')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.lbl = QLabel(self)
# self.lbl.move(60, 40)
#
# qle = QLineEdit(self)
# qle.move(60, 100)
# qle.textChanged[str].connect(self.onChanged)
# qle.setEchoMode(2)
#
# self.setWindowTitle('Enter a password and I will guess it')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def onChanged(self, text):
# self.lbl.setText(text)
# self.lbl.adjustSize()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
#
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QProgressBar,QMainWindow
# from PyQt5.QtCore import QBasicTimer
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.pbar = QProgressBar(self)
# self.pbar.setGeometry(30, 40, 200, 25)
#
# self.btn = QPushButton('Press to add ??? to the shopping cart', self)
# self.btn.move(40, 80)
# self.btn.clicked.connect(self.doAction)
#
# self.timer = QBasicTimer()
# self.step = 0
#
# self.setWindowTitle('QProgressBar')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def timerEvent(self, e):
# if self.step >= 100:
# self.timer.stop()
# self.btn.setText('Press Alt+F4 to checkout')
# return
#
# self.step = self.step + 1
# self.pbar.setValue(self.step)
#
# def doAction(self):
# if self.timer.isActive():
# self.timer.stop()
# self.btn.setText('resume')
# else:
# self.timer.start(100, self)
# self.btn.setText('Stop')
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QSlider, QDial, QPushButton
# from PyQt5.QtCore import Qt
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.slider = QSlider(Qt.Horizontal, self)
# self.slider.move(30, 30)
# self.slider.setRange(0, 50)
# self.slider.setSingleStep(2)
#
# self.dial = QDial(self)
# self.dial.move(30, 50)
# self.dial.setRange(0, 50)
#
# btn = QPushButton('Default', self)
# btn.move(35, 160)
#
# self.slider.valueChanged.connect(self.dial.setValue)
# self.dial.valueChanged.connect(self.slider.setValue)
# btn.clicked.connect(self.button_clicked)
#
# self.setWindowTitle('QSlider and QDial')
# self.setGeometry(300, 300, 400, 200)
# self.show()
#
# def button_clicked(self):
# self.slider.setValue(0)
# self.dial.setValue(0)
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QHBoxLayout, QFrame, QSplitter
# from PyQt5.QtCore import Qt
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# hbox = QHBoxLayout()
#
# top = QFrame()
# top.setFrameShape(QFrame.Box)
# top.setStyleSheet("color: green;"
# "background-color: #08154A")
#
# midleft = QFrame()
# midleft.setFrameShape(QFrame.StyledPanel)
#
# midright = QFrame()
# midright.setFrameShape(QFrame.Panel)
# midright.setStyleSheet("color: green;"
# "background-color: #D51635")
#
# bottom = QFrame()
# bottom.setFrameShape(QFrame.WinPanel)
# bottom.setFrameShadow(QFrame.Sunken)
# bottom.setStyleSheet("color: green;"
# "background-color: #08154A")
#
# splitter1 = QSplitter(Qt.Horizontal)
# splitter1.addWidget(midleft)
# splitter1.addWidget(midright)
#
# splitter2 = QSplitter(Qt.Vertical)
# splitter2.addWidget(top)
# splitter2.addWidget(splitter1)
# splitter2.addWidget(bottom)
#
# hbox.addWidget(splitter2)
# self.setLayout(hbox)
#
# self.setGeometry(300, 300, 300, 200)
# self.setWindowTitle('Tommy Hilfiger')
# self.show()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import (QApplication, QWidget, QGroupBox, QRadioButton
# , QCheckBox, QPushButton, QMenu, QGridLayout, QVBoxLayout)
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# grid = QGridLayout()
# grid.addWidget(self.createFirstExclusiveGroup(), 0, 0)
# grid.addWidget(self.createSecondExclusiveGroup(), 1, 0)
# grid.addWidget(self.createNonExclusiveGroup(), 0, 1)
# grid.addWidget(self.createPushButtonGroup(), 1, 1)
#
# self.setLayout(grid)
#
# self.setWindowTitle('Box Layout')
# self.setGeometry(300, 300, 480, 320)
# self.show()
#
# def createFirstExclusiveGroup(self):
# groupbox = QGroupBox('Exclusive Radio Buttons')
#
# radio1 = QRadioButton('Radio1')
# radio2 = QRadioButton('Radio2')
# radio3 = QRadioButton('Radio3')
# radio1.setChecked(True)
#
# vbox = QVBoxLayout()
# vbox.addWidget(radio1)
# vbox.addWidget(radio2)
# vbox.addWidget(radio3)
# groupbox.setLayout(vbox)
#
# return groupbox
#
# def createSecondExclusiveGroup(self):
# groupbox = QGroupBox('Exclusive Radio Buttons')
# groupbox.setCheckable(True)
# groupbox.setChecked(False)
#
# radio1 = QRadioButton('Radio1')
# radio2 = QRadioButton('Radio2')
# radio3 = QRadioButton('Radio3')
# radio1.setChecked(True)
# checkbox = QCheckBox('Independent Checkbox')
# checkbox.setChecked(True)
#
# vbox = QVBoxLayout()
# vbox.addWidget(radio1)
# vbox.addWidget(radio2)
# vbox.addWidget(radio3)
# vbox.addWidget(checkbox)
# vbox.addStretch(1)
# groupbox.setLayout(vbox)
#
# return groupbox
#
# def createNonExclusiveGroup(self):
# groupbox = QGroupBox('Non-Exclusive Checkboxes')
# groupbox.setFlat(True)
#
# checkbox1 = QCheckBox('Checkbox1')
# checkbox2 = QCheckBox('Checkbox2')
# checkbox2.setChecked(True)
# tristatebox = QCheckBox('Tri-state Button')
# tristatebox.setTristate(True)
#
# vbox = QVBoxLayout()
# vbox.addWidget(checkbox1)
# vbox.addWidget(checkbox2)
# vbox.addWidget(tristatebox)
# vbox.addStretch(1)
# groupbox.setLayout(vbox)
#
# return groupbox
#
# def createPushButtonGroup(self):
# groupbox = QGroupBox('Push Buttons')
# groupbox.setCheckable(True)
# groupbox.setChecked(True)
#
# pushbutton = QPushButton('Normal Button')
# togglebutton = QPushButton('Toggle Button')
# togglebutton.setCheckable(True)
# togglebutton.setChecked(True)
# flatbutton = QPushButton('Flat Button')
# flatbutton.setFlat(True)
# popupbutton = QPushButton('Popup Button')
# menu = QMenu(self)
# menu.addAction('First Item')
# menu.addAction('Second Item')
# menu.addAction('Third Item')
# menu.addAction('Fourth Item')
# popupbutton.setMenu(menu)
#
# vbox = QVBoxLayout()
# vbox.addWidget(pushbutton)
# vbox.addWidget(togglebutton)
# vbox.addWidget(flatbutton)
# vbox.addWidget(popupbutton)
# vbox.addStretch(1)
# groupbox.setLayout(vbox)
#
# return groupbox
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QTabWidget, QVBoxLayout
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# tab1 = QWidget()
# tab2 = QWidget()
#
# tabs = QTabWidget()
# tabs.addTab(tab1, 'Tab1')
# tabs.addTab(tab2, 'Tab2')
#
# vbox = QVBoxLayout()
# vbox.addWidget(tabs)
#
# self.setLayout(vbox)
#
# self.setWindowTitle('QTabWidget')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QVBoxLayout, QCalendarWidget
# from PyQt5.QtCore import QDate
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# cal = QCalendarWidget(self)
# cal.setGridVisible(True)
# cal.clicked[QDate].connect(self.showDate)
#
# self.lbl = QLabel(self)
# date = cal.selectedDate()
# self.lbl.setText(date.toString())
#
# vbox = QVBoxLayout()
# vbox.addWidget(cal)
# vbox.addWidget(self.lbl)
#
# self.setLayout(vbox)
#
# self.setWindowTitle('Pyqt5 Calendar cuz yes')
# self.setGeometry(300, 300, 400, 300)
# self.show()
#
# def showDate(self, date):
# self.lbl.setText(date.toString())
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QSpinBox, QVBoxLayout
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.lbl1 = QLabel('QSpinBox')
# self.spinbox = QSpinBox()
# self.spinbox.setMinimum(-10)
# self.spinbox.setMaximum(30)
# # self.spinbox.setRange(-10, 30)
# self.spinbox.setSingleStep(1)
# self.lbl2 = QLabel('0')
#
# self.spinbox.valueChanged.connect(self.value_changed)
#
# vbox = QVBoxLayout()
# vbox.addWidget(self.lbl1)
# vbox.addWidget(self.spinbox)
# vbox.addWidget(self.lbl2)
# vbox.addStretch()
#
# self.setLayout(vbox)
#
# self.setWindowTitle('QSpinBox')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def value_changed(self):
# self.lbl2.setText(str(self.spinbox.value()))
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
#double spin box
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QDoubleSpinBox, QVBoxLayout
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.lbl1 = QLabel('Select the price')
# self.dspinbox = QDoubleSpinBox()
# self.dspinbox.setRange(0, 100)
# self.dspinbox.setSingleStep(0.5)
# self.dspinbox.setPrefix('$ ')
# self.dspinbox.setDecimals(1)
# self.lbl2 = QLabel('$ 0.0')
#
# self.dspinbox.valueChanged.connect(self.value_changed)
#
# vbox = QVBoxLayout()
# vbox.addWidget(self.lbl1)
# vbox.addWidget(self.dspinbox)
# vbox.addWidget(self.lbl2)
# vbox.addStretch()
#
# self.setLayout(vbox)
#
# self.setWindowTitle('Auction')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def value_changed(self):
# self.lbl2.setText('$ ' + str(self.dspinbox.value()))
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QDateEdit, QVBoxLayout
# from PyQt5.QtCore import QDate
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# lbl = QLabel('QDateEdit')
#
# dateedit = QDateEdit(self)
# dateedit.setDate(QDate.currentDate())
# dateedit.setMinimumDate(QDate(1900, 1, 1))
# dateedit.setMaximumDate(QDate(2100, 12, 31))
# # dateedit.setDateRange(QDate(1900, 1, 1), QDate(2100, 12, 31))
#
# vbox = QVBoxLayout()
# vbox.addWidget(lbl)
# vbox.addWidget(dateedit)
# vbox.addStretch()
#
# self.setLayout(vbox)
#
# self.setWindowTitle('QDateEdit')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QDateTimeEdit, QVBoxLayout
# from PyQt5.QtCore import QDateTime
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# lbl = QLabel('QTimeEdit')
#
# datetimeedit = QDateTimeEdit(self)
# datetimeedit.setDateTime(QDateTime.currentDateTime())
# datetimeedit.setDateTimeRange(QDateTime(1900, 1, 1, 00, 00, 00), QDateTime(2100, 1, 1, 00, 00, 00))
# datetimeedit.setDisplayFormat('yyyy.MM.dd hh:mm:ss')
#
# vbox = QVBoxLayout()
# vbox.addWidget(lbl)
# vbox.addWidget(datetimeedit)
# vbox.addStretch()
#
# self.setLayout(vbox)
#
# self.setWindowTitle('QDateTimeEdit')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import (QApplication, QWidget
# , QLineEdit, QTextBrowser, QPushButton, QVBoxLayout)
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.le = QLineEdit()
# self.le.returnPressed.connect(self.append_text)
#
# self.tb = QTextBrowser()
# self.tb.setAcceptRichText(True)
# self.tb.setOpenExternalLinks(True)
#
# self.clear_btn = QPushButton('Clear')
# self.clear_btn.pressed.connect(self.clear_text)
#
# vbox = QVBoxLayout()
# vbox.addWidget(self.le, 0)
# vbox.addWidget(self.tb, 1)
# vbox.addWidget(self.clear_btn, 2)
#
# self.setLayout(vbox)
#
# self.setWindowTitle('QTextBrowser')
# self.setGeometry(300, 300, 300, 300)
# self.show()
#
# def append_text(self):
# text = self.le.text()
# self.tb.append(text)
# self.le.clear()
#
# def clear_text(self):
# self.tb.clear()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QTextEdit, QVBoxLayout
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.lbl1 = QLabel('Type in ANYTHING')
# self.te = QTextEdit()
# self.te.setAcceptRichText(False)
# self.lbl2 = QLabel('START TYPING YOU FOOL')
#
# self.te.textChanged.connect(self.text_changed)
#
# vbox = QVBoxLayout()
# vbox.addWidget(self.lbl1)
# vbox.addWidget(self.te)
# vbox.addWidget(self.lbl2)
# vbox.addStretch()
#
# self.setLayout(vbox)
#
# self.setWindowTitle('Notepad')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def text_changed(self):
# text = self.te.toPlainText()
# self.lbl2.setText('The number of words is ' + str(len(text.split())))
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import *
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
#
# self.tableWidget = QTableWidget()
# self.tableWidget.setRowCount(20)
# self.tableWidget.setColumnCount(4)
#
# self.tableWidget.setEditTriggers(QAbstractItemView.NoEditTriggers)
# # self.tableWidget.setEditTriggers(QAbstractItemView.DoubleClicked)
# # self.tableWidget.setEditTriggers(QAbstractItemView.AllEditTriggers)
#
# self.tableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
# # self.tableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
#
# for i in range(20):
# for j in range(4):
# self.tableWidget.setItem(i, j, QTableWidgetItem(str((i+1)*(j+1))))
#
# layout = QVBoxLayout()
# layout.addWidget(self.tableWidget)
# self.setLayout(layout)
#
# self.setWindowTitle('Multiplication chart')
# self.setGeometry(300, 100, 600, 400)
# self.show()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
#input dialog
# import sys
# from PyQt5.QtWidgets import (QApplication, QWidget, QPushButton, QLineEdit, QInputDialog)
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.btn = QPushButton('Log in', self)
# self.btn.move(30, 30)
# self.btn.clicked.connect(self.showDialog)
#
# self.le = QLineEdit(self)
# self.le.move(120, 35)
#
# self.setWindowTitle('system')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def showDialog(self):
# text, ok = QInputDialog.getText(self, 'Input password', 'Enter the Password:')
#
# if ok:
# self.le.setText(str(text))
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QPushButton, QFrame, QColorDialog
# from PyQt5.QtGui import QColor
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# col = QColor(0, 0, 0)
#
# self.btn = QPushButton('Choose color', self)
# self.btn.move(30, 30)
# self.btn.clicked.connect(self.showDialog)
#
# self.frm = QFrame(self)
# self.frm.setStyleSheet('QWidget { background-color: %s }' % col.name())
# self.frm.setGeometry(130, 35, 100, 100)
#
# self.setWindowTitle('Color Dialog')
# self.setGeometry(300, 300, 250, 180)
# self.show()
#
# def showDialog(self):
# col = QColorDialog.getColor()
#
# if col.isValid():
# self.frm.setStyleSheet('QWidget { background-color: %s }' % col.name())
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# font dialouge
# import sys
# from PyQt5.QtWidgets import (QApplication, QWidget, QVBoxLayout
# , QPushButton, QSizePolicy, QLabel, QFontDialog)
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# btn = QPushButton('Dialog', self)
# btn.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
# btn.move(20, 20)
# btn.clicked.connect(self.showDialog)
#
# vbox = QVBoxLayout()
# vbox.addWidget(btn)
#
# self.lbl = QLabel('The quick brown fox jumps over the lazy dog', self)
# self.lbl.move(130, 20)
#
# vbox.addWidget(self.lbl)
# self.setLayout(vbox)
#
# self.setWindowTitle('Font Dialog')
# self.setGeometry(300, 300, 250, 180)
# self.show()
#
# def showDialog(self):
# font, ok = QFontDialog.getFont()
#
# if ok:
# self.lbl.setFont(font)
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QMainWindow, QTextEdit, QAction, QFileDialog
# from PyQt5.QtGui import QIcon
#
#
# class MyApp(QMainWindow):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.textEdit = QTextEdit()
# self.setCentralWidget(self.textEdit)
# self.statusBar()
#
# openFile = QAction(QIcon('open.png'), 'Open', self)
# openFile.setShortcut('Ctrl+O')
# openFile.setStatusTip('Open New File')
# openFile.triggered.connect(self.showDialog)
#
# menubar = self.menuBar()
# menubar.setNativeMenuBar(False)
# fileMenu = menubar.addMenu('&File')
# fileMenu.addAction(openFile)
#
# self.setWindowTitle('File Dialog')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def showDialog(self):
# fname = QFileDialog.getOpenFileName(self, 'Open file', './')
#
# if fname[0]:
# f = open(fname[0], 'r')
#
# with f:
# data = f.read()
# self.textEdit.setText(data)
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QMessageBox
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.setWindowTitle('QMessageBox')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def closeEvent(self, event):
# reply = QMessageBox.question(self, 'Message', 'Are you sure to quit?',
# QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
#
# if reply == QMessageBox.Yes:
# event.accept()
# else:
# event.ignore()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QLCDNumber, QDial, QVBoxLayout
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# lcd = QLCDNumber(self)
# dial = QDial(self)
#
# vbox = QVBoxLayout()
# vbox.addWidget(lcd)
# vbox.addWidget(dial)
# self.setLayout(vbox)
#
# dial.valueChanged.connect(lcd.display)
#
# self.setWindowTitle('Signal and Slot')
# self.setGeometry(300, 300, 200, 200)
# self.show()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import (QApplication, QWidget
# , QLCDNumber, QDial, QPushButton, QVBoxLayout, QHBoxLayout)
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# lcd = QLCDNumber(self)
# dial = QDial(self)
# btn1 = QPushButton('Big', self)
# btn2 = QPushButton('Small', self)
#
# hbox = QHBoxLayout()
# hbox.addWidget(btn1)
# hbox.addWidget(btn2)
#
# vbox = QVBoxLayout()
# vbox.addWidget(lcd)
# vbox.addWidget(dial)
# vbox.addLayout(hbox)
# self.setLayout(vbox)
#
# dial.valueChanged.connect(lcd.display)
# btn1.clicked.connect(self.resizeBig)
# btn2.clicked.connect(self.resizeSmall)
#
# self.setWindowTitle('Signal and Slot')
# self.setGeometry(200, 200, 200, 250)
# self.show()
#
# def resizeBig(self):
# self.resize(400, 500)
#
# def resizeSmall(self):
# self.resize(200, 250)
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
#reimplement event handler
# import sys
# from PyQt5.QtCore import Qt
# from PyQt5.QtWidgets import QApplication, QWidget
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.setWindowTitle('Reimplementing event handler')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def keyPressEvent(self, e):
# if e.key() == Qt.Key_Escape:
# self.close()
# elif e.key() == Qt.Key_F:
# self.showFullScreen()
# elif e.key() == Qt.Key_N:
# self.showNormal()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QApplication, QWidget, QLabel
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# x = 0
# y = 0
#
# self.text = 'x: {0}, y: {1}'.format(x, y)
# self.label = QLabel(self.text, self)
# self.label.move(20, 20)
#
# self.setMouseTracking(True)
#
# self.setWindowTitle('Reimplementing event handler')
# self.setGeometry(300, 300, 300, 200)
# self.show()
#
# def mouseMoveEvent(self, e):
# x = e.x()
# y = e.y()
#
# text = 'x: {0}, y: {1}'.format(x, y)
# self.label.setText(text)
# self.label.adjustSize()
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QWidget, QApplication
# from PyQt5.QtGui import QPainter, QPen
# from PyQt5.QtCore import Qt
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.setGeometry(300, 300, 400, 300)
# self.setWindowTitle('Points')
# self.show()
#
# def paintEvent(self, e):
# qp = QPainter()
# qp.begin(self)
# self.draw_point(qp)
# qp.end()
#
# def draw_point(self, qp):
# qp.setPen(QPen(Qt.blue, 8))
# qp.drawPoint(self.width()/2, self.height()/2)
#
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QWidget, QApplication
# from PyQt5.QtGui import QPainter, QPen
# from PyQt5.QtCore import Qt
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.setGeometry(300, 300, 400, 300)
# self.setWindowTitle('drawLine')
# self.show()
#
# def paintEvent(self, e):
# qp = QPainter()
# qp.begin(self)
# self.draw_line(qp)
# qp.end()
#
# def draw_line(self, qp):
# qp.setPen(QPen(Qt.black, 3, Qt.SolidLine))
# qp.drawLine(20, 20, 380, 20)
# qp.drawText(30, 40, 'Qt.SolidLine')
#
# qp.setPen(QPen(Qt.black, 3, Qt.DashLine))
# qp.drawLine(20, 70, 380, 70)
# qp.drawText(30, 90, 'Qt.DashLine')
#
# qp.setPen(QPen(Qt.black, 3, Qt.DotLine))
# qp.drawLine(20, 120, 380, 120)
# qp.drawText(30, 140, 'Qt.DotLine')
#
# qp.setPen(QPen(Qt.black, 3, Qt.DashDotLine))
# qp.drawLine(20, 170, 380, 170)
# qp.drawText(30, 190, 'Qt.DashDotLine')
#
# qp.setPen(QPen(Qt.black, 3, Qt.DashDotDotLine))
# qp.drawLine(20, 220, 380, 220)
# qp.drawText(30, 240, 'Qt.DashDotDotLine')
#
# pen = QPen(Qt.black, 3, Qt.CustomDashLine)
# pen.setDashPattern([4, 3, 2, 5])
# qp.setPen(pen)
# qp.drawLine(20, 270, 380, 270)
# qp.drawText(30, 290, 'Qt.CustomDashLine')
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())
# import sys
# from PyQt5.QtWidgets import QWidget, QApplication
# from PyQt5.QtGui import QPainter, QPen, QColor, QBrush
# from PyQt5.QtCore import Qt
#
#
# class MyApp(QWidget):
#
# def __init__(self):
# super().__init__()
# self.initUI()
#
# def initUI(self):
# self.setGeometry(300, 300, 400, 300)
# self.setWindowTitle('drawRect')
# self.show()
#
# def paintEvent(self, e):
# qp = QPainter()
# qp.begin(self)
# self.draw_rect(qp)
# qp.end()
#
# def draw_rect(self, qp):
# brush = QBrush(Qt.SolidPattern)
# qp.setBrush(brush)
# qp.drawRect(20, 10, 100, 60)
# qp.drawText(20, 90, 'Qt.SolidPattern')
#
# brush = QBrush(Qt.Dense1Pattern)
# qp.setBrush(brush)
# qp.drawRect(150, 10, 100, 60)
# qp.drawText(150, 90, 'Qt.Dense1Pattern')
#
# brush = QBrush(Qt.Dense2Pattern)
# qp.setBrush(brush)
# qp.drawRect(280, 10, 100, 60)
# qp.drawText(280, 90, 'Qt.Dense2Pattern')
#
# brush = QBrush(Qt.HorPattern)
# qp.setBrush(brush)
# qp.drawRect(20, 110, 100, 60)
# qp.drawText(20, 190, 'Qt.HorPattern')
#
# brush = QBrush(Qt.VerPattern)
# qp.setBrush(brush)
# qp.drawRect(150, 110, 100, 60)
# qp.drawText(150, 190, 'Qt.VerPattern')
#
# brush = QBrush(Qt.CrossPattern)
# qp.setBrush(brush)
# qp.drawRect(280, 110, 100, 60)
# qp.drawText(280, 190, 'Qt.CrossPattern')
#
# brush = QBrush(Qt.BDiagPattern)
# qp.setBrush(brush)
# qp.drawRect(20, 210, 100, 60)
# qp.drawText(20, 290, 'Qt.BDiagPattern')
#
# brush = QBrush(Qt.FDiagPattern)
# qp.setBrush(brush)
# qp.drawRect(150, 210, 100, 60)
# qp.drawText(150, 290, 'Qt.FDiagPattern')
#
# brush = QBrush(Qt.DiagCrossPattern)
# qp.setBrush(brush)
# qp.drawRect(280, 210, 100, 60)
# qp.drawText(280, 290, 'Qt.DiagCrossPattern')
#
# if __name__ == '__main__':
# app = QApplication(sys.argv)
# ex = MyApp()
# sys.exit(app.exec_())