PyQt使ってみたかったけど、ver.4とver.5で違いが結構あるぽいので Differences Between PyQt4 and PyQt5 — PyQt 5.2.1 Reference Guide を抄訳してみた。 なにか変なところがあったら教えてくだちい。 PyQt4とPyQt5の違い PyQt5とPyQt4は、互換性がありません(が、PyQt4からPyQt5へのアプリケーションの移植は難しいことではないと言えます)。 このセクションでは、PyQt5とPyQt4の間の主要な違いについて説明します。 サポートするPythonのバージョン Python2.6より古いバージョンはサポートしません。 廃止予定の機能 PyQt5では、deprecatedになった又はQt v5.0で廃止したAPIについてはサポートしません。 しかし、いくつかのAPIをうっかり含んでしまうかもしれません。
標準的なフリージング # setup.py import py2exe from distutils.core import setup py2exe_options = { "compressed": 1, # 圧縮する "optimize": 2, "bundle_files": 3, "includes" : ["sip",] } setup( options={"py2exe" : py2exe_options}, windows=[{"script" : "main.py"}], # PyQt ファイル zipfile="[zipped.lib ファイル名]", ) 私の環境 (XP, Py2.6.4) では、 py2exe_options の bundle_files は 3 (分割ファイル) じゃないと動作しませんでした。 jpeg や gif 等の画像を取り扱う場合 PyQ
# -*- coding: utf-8 -*- import sys from PyQt4 import QtGui class Tab1Widget(QtGui.QWidget): def __init__(self, parent=None): super(Tab1Widget, self).__init__() closeBtn = QtGui.QPushButton('Close') closeBtn.clicked.connect(parent.close) hbox = QtGui.QHBoxLayout() hbox.addWidget(closeBtn) self.setLayout(hbox) class UI(QtGui.QWidget): def __init__(self): super(UI, self).__init__() self.initUI() def
すぐ忘れる筆者用メモです。 適当に行き会ったものを挙げています。随時追加のつもり。 ラインエディットテキストを入力 QString str; if ( !str.isEmpty() ) { lineEdit->setText( str ); } テキストを取得 QString str = lineEdit->text(); パスワード入力モードにする lineEdit->setEchoMode( QLineEdit::Password ) プロパティなのでQtDesignerで設定が可能です。 チェックボックスチェック状態を取得 if ( checkBox->checkState() == Qt::Checked ) { // チェックされているときの処理 } else { // チェックされていないときの処理 } ファイル選択ダイアログ QFileDialog::Options opti
from PyQt4.QtCore import * from PyQt4.QtGui import * if __name__ == '__main__': import sys app = QApplication(sys.argv) win = QLabel("Hello PyQt4 world") win.show() sys.exit( app.exec_() ) シグナル・スロットの例 シグナルとスロットを接続するには、QObject.connect、SIGNAL及びSLOTを使用する。 SIGNAL及びSLOTに文字列を渡す点がC++版のQtと異なる。 from PyQt4.QtCore import * from PyQt4.QtGui import * class MyWidget(QWidget): def __init__(self, parent=None): su
Including this bug… there have been… exactly… one… thousand… five hundred and two I was given a job to smarten up a GUI program which is implemented in PyQt. One of the tasks is to put up some icons in the user interface. I know that Qt includes it’s own set of icons. However, I can’t find any page online showing what these icons look like. So I wrote a little program to list all the available Qt
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く