2012-01-01から1ヶ月間の記事一覧

QThread

PyQtに実装されてある非同期処理です。 import sys from PyQt4 import QtCore from PyQt4 import QtGui class Worker(QtCore.QThread): mutex = QtCore.QMutex() def __init__(self, name = "", parent = None): QtCore.QThread.__init__(self, parent) self…

FBXアニメーションデータを編集できるようにする

FBXモデルをインポートしたとき、アニメーション情報は上書きを防ぐためreadonlyになっています。 この状態だと編集、イベントコールの設定など出来ません。 解決策は、新しいanimファイルを作成しアニメーションデータをコピーします。 するとそれはリンク…

threading.semaphore

semaphore排他オブジェクトです。 threading.Semaphoreとthreading.BoundedSemaphoreがあります。 import time import thread import threading import random counter = 0 counter = 0 def semaphore_func(semaphore): with semaphore: thread_func() globa…

threading.Condition

Conditionという排他オブジェクトです。 import time import threading class MyThread(threading.Thread): lock = threading.Lock() def __init__(self, name, lifetime, condition): threading.Thread.__init__(self) self.lifetime = lifetime self.condi…

threading.Event

1回書いたのに記事が消えてしまった・・・ソースだけ貼って寝よう import time import thread import threading end_count = 3 def thread_func(event, counter): time.sleep(2) while len(counter) < end_count: while not event.isSet(): print "wait result:…

threading.Lock

うちの64bitパチコンだとpyscripterの挙動がおかしいよ。結構まえからいろいろおかしかったのでインストールし直したけどなんかダイアログ出てきて開けなくなったので(前はどうにかして開けるようにした)、めんどくさいので諦めて、Spyderで書いてます。thre…

AndroidSDK更新作業

AndroidSDK4.0.3落としたときの作業メモ。http://developer.android.com/sdk/index.html ここからインストーラを落とす。 起動して、既にあるSDKの場所のパスを指定する。 SDKマネージャが開かれるので、欲しいバージョンをインストールする。 このSDKマネー…

QProgressBar

import sys from PyQt4 import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() # create layout self.vbox = QtGui.QVBoxLayout(self) # #self.vbox.setSizeConstraint(QtGui.QLayout.SetMaximumSize) #…

スクリプトオブジェクトを生成するには

Newで生成しようとすると失敗する。 Script script = new Script(); You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can in…

QCheckBox

import sys from PyQt4 import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() self.cb = QtGui.QCheckBox('&Show title', self) self.cb.move(20, 20) # 状態を3つに増やす self.cb.setTristate() # s…

QSlider

import sys from PyQt4 import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() # mainlayout hbox = QtGui.QVBoxLayout(self) # background self.bgColor = QtGui.QColor(0, 0, 0) self.bg = QtGui.QFra…