The Python GTK+ 3 Tutorial Release: 3.4 Date: Jun 08, 2024 Copyright: 2011, The PyGObject Community This tutorial gives an introduction to writing GTK+ 3 applications in Python. Prior to working through this tutorial, it is recommended that you have a reasonable grasp of the Python programming language. GUI programming introduces new problems compared to interacting with the standard output (cons
2.1. Simple Example¶ To start with our tutorial we create the simplest program possible. This program will create an empty 200 x 200 pixel window. import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk win = Gtk.Window() win.connect("destroy", Gtk.main_quit) win.show_all() Gtk.main()
Getting Started¶ To get things started we will try to run a very simple GTK based GUI application using the PyGObject provided Python bindings. First create a small Python script called hello.py with the following content and save it somewhere: import sys import gi gi.require_version("Gtk", "4.0") from gi.repository import GLib, Gtk class MyApplication(Gtk.Application): def __init__(self): super()
やりたかったこと Windows環境のPython3でGTK+3を使いたかった。 ハマった時の環境 Windows 10 Python 3.5.2 何が起きたか PythonのインストールからPyGObjectの導入まで、何もかも上手く行っていた。 が、しかし。 >>> import gi Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'gi' 大事なものがimport出来ない… 結論 PyGObjectがPython3.5以上に対応してなかった。 一旦全部消してPython3.4をインストールして、PyGObjectを導入し直したら動いた。 ちなみにPython3.4.5のWindows版が見当たらなかったので3.4.4をインストールし
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く