This file contains 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, QDialog, QLineEdit, QPushButton, QVBoxLayout) | |
class Form(QDialog): | |
def __init__(self): | |
super().__init__() | |
self.edit = QLineEdit('Your name') | |
self.edit.selectAll() | |
This file contains 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, QMainWindow, QWidget, QHBoxLayout, QMenuBar, QStatusBar | |
from PyQt5.QtCore import QRect, QMetaObject,QRectF | |
from PyQt5.QtGui import QPainter, QPen, QColor, QFont | |
from PyQt5.Qt import Qt | |
class Demo(QMainWindow): | |
def __init__(self): | |
super().__init__() | |
self.text = 'Hello World' |
This file contains 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, QLabel | |
app = QApplication(sys.argv) | |
label1 = QLabel('Hello World') | |
label1.resize(200, 300) | |
label1.move(600, 400) | |
label2 = QLabel('<font color=blue size=16>Hello World </font>') |
This file contains 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 pandas as pd | |
df = <'your dataframe object'> | |
# print(df['customer_id'].to_list()) | |
headers = df.columns.values.tolist() | |
body = df.values.tolist() | |
body.insert(0, headers) | |
print(body) |
This file contains 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
from PIL import Image, ImageChops | |
img1 = Image.open('source1.jpg') | |
img2 = Image.open('target1.jpg') | |
diff = ImageChops.difference(img1, img2) | |
if diff.getbbox(): | |
diff.show() |
This file contains 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
from turtle import * | |
def snowflake(lengthSide, levels): | |
if levels == 0: | |
forward(lengthSide) | |
return | |
lengthSide /= 3.0 | |
snowflake(lengthSide, levels-1) |
This file contains 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, QPushButton, QLineEdit | |
class DragAndDrop(QWidget): | |
def __init__(self): | |
super().__init__() | |
self.setWindowTitle('Drag and drop') | |
self.resize(300, 150) | |
self.initUI() |
This file contains 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 io, os | |
from google.cloud import vision | |
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r"ServiceAcct_Token.json" | |
client = vision.ImageAnnotatorClient() | |
file_name = 'image file' | |
image_path = os.path.join('.\images', file_name) | |
with io.open(image_path, 'rb') as image_file: |
This file contains 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 datetime import datetime | |
import calendar | |
from PyQt5.QtWidgets import QApplication, QWidget, QCalendarWidget | |
from PyQt5.QtCore import QDate | |
class CalendarDemo(QWidget): | |
global currentYear, currentMonth | |
currentMonth = datetime.now().month |