Skip to content

Instantly share code, notes, and snippets.

<div class="box">
<p id="res" class="res">まだクリック無し!</p>
<div class="btn-square">
<p id="btn">ボタン</p>
</div>
</div>
<script>// <![CDATA[
var Value = 0;
document.getElementById("btn").onclick = function() {
import bpy
import bmesh
bl_info = {
"name": "TomoG_Sample",
"author": "TomoG",
"version": (1, 0),
"blender": (2, 9, 0),
"location": "",
"description": "sample",
import os
filepath = 'Sample/sample'
#フォルダ作成(存在すれば作成しない)
if not os.path.isdir(filepath):
os.mkdir(filepath)
import PySimpleGUI as sg
layout = [ [ sg.Text("ファイル選択"),sg.InputText(),sg.FileBrowse() ] ,
[sg.Text("文字入力") ,sg.InputText("ここに文字入力",key ="-TEXT-")],
[sg.Checkbox("チェックボックス",key="CHECK-BOX-")],
[sg.Button("ボタン", key="-SAMPLE-BUTTON-")] ,
[sg.Listbox(["Sample A","Sample B","Sample C"],size=(50,5))],
[sg.Combo(["Sample D","Sample E","Sample F"])],
[sg.ProgressBar(1000,orientation="h",size=(20,20),key="progbar")],
]
import os
from PIL import Image
import getpass
import glob
import_file = os.path.join('C:/Users',getpass.getuser(),'入力ファイル名')
export_file = os.path.join('C:/Users',getpass.getuser(),'入力ファイル名')
#リサイズ後の横幅
RESIZE_X = 1280
Sample_Var = 0
def Process1():
Sample_Var = 1
def Process2():
global Sample_Var
Sample_Var = 1
def Process3():
str1 = "abcd abcd abcd"
str2 = str1.replace("ab","1")
print(str2)
#1cd 1cd 1cd
print(str1.replace("ab","x",2))
#xcd xcd abcd
print(str1.replace("a",""))
str1 = "abcd abcd abcd"
str2 = str1.translate(str1.maketrans({"a": "1", "c": "2"}))
print(str2)
#1b2d 1b2d 1b2d
print(str1.translate(str1.maketrans({"b": "x", "d": None})))
#axc axc axc
print(str1.translate(str1.maketrans({"ab": "xy"})))
str1 = "ababcdcd cdbacdba abcdabcd"
import re
str2 = re.sub("a","1",str1)
print(str2)
#1b1bcdcd cdb1cdb1 1bcd1bcd
print(re.sub("a","1",str1,4))
#1b1bcdcd cdb1cdb1 abcdabcd
import re
text = '111-222-[333]-444-[5555]'
#======================================================
#====================== 1 =============================
#======================================================
#[]内に数字が3つある部分を抽出(エラー処理入り)
pattern1 = re.compile(r'\[(\d{3})\]')
result1 = pattern1.search(text)