Instantly share code, notes, and snippets.

View resize_image.py
#!python2
# -*- coding: utf-8 -*-
from PIL import Image, ImageOps
from PIL.ExifTags import TAGS
import os.path
import re
import sys
image_dir = u"S:/blog_img/"
View add_backlog_issuecomment.py
# -*- coding: utf-8 -*-
import requests
import json
API_KEY = "<KEY>"
base_url = "https://<ID>.backlog.com/api/v2/"
issue_key = "ACS-2"
# add comment.
View import_all_mod.py
# -*- coding: utf-8 -*-
import os.path
import glob
import sys
pathThisFile = os.path.dirname(os.path.abspath(__file__))
py_file = glob.glob(pathThisFile + "/*.py")
for py in py_file:
View window_close_maya2018.py
## -*- coding: utf-8 -*-
#*----------------------------------------------*#
# 各種モジュール読み込み
#*----------------------------------------------*#
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *
from maya import OpenMayaUI as omUI
View table_view.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'table_view.ui'
#
# Created: Tue Jul 31 14:39:30 2018
# by: pyside-uic 0.2.15 running on PySide 1.2.4
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
View get_checkd_item.py
# -*- coding: utf-8 -*-
from PySide import QtCore, QtGui
import os.path
from ui import table_view
CURRENT_PATH = os.path.dirname(__file__)
class TableView(QtGui.QDialog):
View encodeing.py
if hasattr(sys, 'setdefaultencoding'):
import locale
lang, enc = locale.getdefaultlocale()
sys.setdefaultencoding('utf-8')
View PySide_table.css
QDialog {
background-color: $color_06;
}
#tabPane {
background-color: blue;
border : 10px solid yellow;
}
QTabWidget::pane {
View named_tuple_shotgun.py
# -*- coding: utf-8 -*-
# Dictをいい感じに整形して val.param 形式にしてくれる
# 参考 https://stackoverflow.com/questions/6578986/how-to-convert-json-data-into-a-python-object
from collections import namedtuple
class Test(object):
data=None
def __init__(self,data):
self.data = data
View default_dict.py
# -*- coding: utf-8 -*-
from collections import defaultdict
src = [('a',1),('b',2),('c',3),('a',3)]
# 使わないとき
d = defaultdict(list)