Skip to content

Instantly share code, notes, and snippets.

View Tuhin-thinks's full-sized avatar
🏅
Learning

Tuhin Mitra Tuhin-thinks

🏅
Learning
View GitHub Profile
@Tuhin-thinks
Tuhin-thinks / bubble_notification.py
Created December 29, 2021 19:10
PyQt5 bubble notification, original code from https://stackoverflow.com/a/59327658/8201723 (adapted for latest PyQt5 version)
import sys
from PyQt5.QtCore import (QRectF, Qt, QPropertyAnimation, pyqtProperty,
QPoint, QParallelAnimationGroup, QEasingCurve)
from PyQt5.QtGui import QPainter, QPainterPath, QColor, QPen
from PyQt5.QtWidgets import (QLabel, QWidget, QVBoxLayout, QApplication,
QLineEdit, QPushButton)
class BubbleLabel(QWidget):
@Tuhin-thinks
Tuhin-thinks / WindowNotification.py
Created December 29, 2021 18:54
Code to show windows notification/desktop notification in PyQt5
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
class QToaster(QtWidgets.QFrame):
closed = QtCore.pyqtSignal()
def __init__(self, *args, **kwargs):
super(QToaster, self).__init__(*args, **kwargs)
QtWidgets.QHBoxLayout(self)
@Tuhin-thinks
Tuhin-thinks / parse_qt_palette.py
Created December 23, 2021 19:56
create QPalette object from xml in PyQt5 palette generated using "Save palette" option in Qt Designer
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QBrush, QColor, QPalette
from xml.etree import ElementTree
def parse_xml(file_path) -> 'QPalette':
def generate_brushes(brush_index):
# required imports
assert QColor
@Tuhin-thinks
Tuhin-thinks / Proxy_SymbolNamesFilter.py
Created December 23, 2021 19:48
To create filtering on pandas.DataFrame used in PyQt5 QtWiddgets.QTableView.
import pandas as pd
from PyQt5 import QtCore
class SymbolsProxy(QtCore.QSortFilterProxyModel):
def __init__(self, df_symbol_exchange: 'pd.DataFrame', parent=None):
super(SymbolsProxy, self).__init__(parent=parent)
self.check_df = df_symbol_exchange
self.exchange_filter = None
self.symbols_filter: 'QtCore.QRegularExpression' =\
@Tuhin-thinks
Tuhin-thinks / print_format_list.py
Last active March 9, 2024 17:53
Function to print header along with list of list in tabular format.
import re
def print_formatted(_header, _items, padding=10, alignment="^"):
"""
Function to print header along with list of list in tabular format.
:param alignment: ^ -center alignment; < -left alignment; > -right alignment
:param _header: header strings for the table
:param _items: list of list, representing collection of rows
:param padding: padding count
@Tuhin-thinks
Tuhin-thinks / multiple_inheritence.py
Created October 8, 2021 11:43
Multiple Inheritence Python
class A:
def __init__(self):
pass
def make_sound(self):
print("quack..quack..quack..quack..\n") # duck sound
def make_sound_A(self):
print("Yelp...Yelp...Yelp\n") # fox sound
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Tuhin-thinks
Tuhin-thinks / Simple_API_2__v2.ipynb
Created June 7, 2021 06:34
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Tuhin-thinks
Tuhin-thinks / Simple_API_2__v2.ipynb
Created June 7, 2021 06:34
Created on Skills Network Labs
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.