私はgi.repositoryを理解するのに困っている
私はこのコードを自分のコードで使う
from gi.repository import Gtk
しかし、私はいくつかのコンポーネントを使用したい場合、私はインポートエラーを取得する
私は検索し、GtkSource、Vte、GLibのようないくつかのコンポーネントのために働いた…
だから私のコードは
from gi.repository import Gtk, GtkSource, Vte, GLib
すべてうまくいきましたが、私のキャンバスに描画するmatplotlibを追加したい場合は、エラーが出ます
enter code/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py:40: Warning: specified class size for type `PyGtkGenericCellRenderer' is smaller than the parent type's `GtkCellRenderer' class size
from gtk import _gtk
/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_type_get_qdata: assertion `node != NULL' failed
from gtk import _gtk
/usr/lib64/python2.7/site-packages/gtk-2.0/gtk/__init__.py:40: Warning: g_ascii_strncasecmp: assertion `s2 != NULL' failed
from gtk import _gtk
Segmentation fault (core dumped) here
matplotlibをgi.repositoryで動作させるにはどうすればよいですか?
ありがとうございました
ベストアンサー
Gtk3のサポートは最近追加されましたようです。私はそれが主要なディストリビューションで利用可能になるまでそれは時間がかかるだろうと思う。
最善の解決策は、最新バージョンをダウンロードしてインストールすることです。
私のUbuntu 11.10にインストールするのを避けるための回避策として、
dowloaded
backend_gtk3.pyとbackend_gtk3agg.pyファイルがありますと直接インポートします:
from gi.repository import Gtk
from matplotlib.figure import Figure
from backend_gtk3agg import FigureCanvasGTK3Agg as FigCanvas
バックエンド_gtk3agg.py行6を変更する必要がありました。
import backend_agg
〜と
from matplotlib.backends import backend_agg
, so it can import the module from my installation. So far it
works for me, but I understand this solution can’t work 〜と
different versions of matplotlib.