Skip to content

Instantly share code, notes, and snippets.

View DataSolveProblems's full-sized avatar
💭
Github Working In Progress

Jie Jenn DataSolveProblems

💭
Github Working In Progress
View GitHub Profile
import sys
from PyQt5.QtWidgets import (QApplication, QMainWindow, QAction)
class MenuBarDemo(QMainWindow):
def __init__(self):
super().__init__()
self.setWindowTitle('Menubar Demo')
self.resize(600, 500)
self.menuBar = self.menuBar()
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()
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'
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>')
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)
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()
from turtle import *
def snowflake(lengthSide, levels):
if levels == 0:
forward(lengthSide)
return
lengthSide /= 3.0
snowflake(lengthSide, levels-1)
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()
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:
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