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

ライセンスに関して

PyQtとPySideのライセンスに関して少し調べた。PyQtはGPLで、PySideはLGPLらしい。ライセンスの概要は以下が参考になる。 GPLやMITやCCなど主要ライセンスの内容と意味のまとめ (http://smkn.xsrv.jp/blog/2009/03/summary_for_gpl_mit_cc_etc/) 以下のサイ…

3Dを扱うGUI

3Dを扱うGUIアプリを作る場合、以下の4通りの組合せが考えられる。 Python2.x, 32bit Python2.x, 64bit Python3.x, 32bit Python3.x, 64bit 以下のライブラリを使用するものとする。 PyQt PyOpenGL PyOpenGLは、Python3.xに対応していないので、Python2.xで…

ツリー

ツリーには、QTreeViewを使う。モデルは、QStandardItemModelとQAbstractItemModelの2つがある。とりあえず、簡単な前者の方を使用する。 import sys from PyQt4 import QtCore, QtGui class TreeView(QtGui.QTreeView): def __init__(self, parent=None): s…

タブ

import sys from PyQt4 import QtGui class TabWidget(QtGui.QTabWidget): def __init__(self, parent=None): super (TabWidget, self).__init__(parent) self.setTabsClosable(True) self.tabCloseRequested.connect(self.removeTab) self.addTab(QtGui.QLa…

ファイルのドラッグ&ドロップ

None is None is None: PyQtでファイルのドラッグ&ドロップ (http://d.hatena.ne.jp/doloopwhile/20100108/1275174371) を参考に。 import sys from PyQt4.QtGui import * class MainWidget(QWidget): def __init__(self, parent=None): super(MainWidget, …

glOrthoとgluLookAt

glOrthoとgluLookAtは以下が参考になる。 シミュレーション屋のためのOpenGL入門プログラミング (http://www.nda.ac.jp/cc/users/iwase/OLD/COMP/OpenGL/glhowto.html#22) MFCによるOpenGLプログラミング (http://odalab.spub.chitose.ac.jp/~oda/lang/openg…

PyQt4でOpenGL

とりあえず、簡単なサンプルを作成した。 # coding: cp932 import sys from PyQt4 import QtCore, QtGui, QtOpenGL from OpenGL import GL, GLU, GLUT r = 0.0 light_ambient = [1.0, 1.0, 1.0, 1.0] # 環境光(白色) light_diffuse = [1.0, 1.0, 1.0, 1.0]…

PyQt4メモ

The PyQt4 tutorial (http://zetcode.com/tutorials/pyqt4/) saito's memo (http://memo.saitodev.com/home/python_pyqt4) Pythonのスクリプティング (http://www.cuc.ac.jp/~minohara/lecture/iseminar/python/index.html)

デフォルト引数の奇妙な挙動

http://webtech-walker.com/archive/2010/10/13191417.html を見ていて、ふと疑問に思った。 def foo(x=[]): print '--1', x if x: print '--2', x x = [] x.append(1) print x foo() foo() foo() 出力: --1 [] [1] --1 [1] --2 [1] [1] --1 [1] --2 [1] [1]…

メモ

インストールされているモジュール一覧を表示。 >>> help('modules')

メモ

Python Scientific Lecture Notes (http://www.ike-dyn.ritsumei.ac.jp/~uchida/scipy-lecture-notes/)