前提・実現したいこと
ここに質問の内容を詳しく書いてください。
(例)PyGtkで画像処理を行おうとしているのですが、エラーが出ているところをどう直せばいいかわかりません。教えていただけた幸いです。よろしくお願いいたします。
発生している問題・エラーメッセージ
Traceback (most recent call last):
File "ip.py", line 7, in <module>
class ImageProcessing:
File "ip.py", line 11, in ImageProcessing
pix = Gtk.Gdk.pixbuf_new_from_file("~/Dektop/GTK/images/test1-fix.jpg")
File "/usr/local/lib/python3.7/site-packages/gi/overrides/init.py", line 39, in getattr
return getattr(self._introspection_module, name)
File "/usr/local/lib/python3.7/site-packages/gi/module.py", line 132, in getattr
self.name, name))
AttributeError: 'gi.repository.Gtk' object has no attribute 'Gdk'
該当のソースコード
import cv2
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository.GdkPixbuf import Pixbuf
class ImageProcessing:
image_file_name = "~/Dektop/GTK/images/test1-fix.jpg" image = cv2.imread(image_file_name) pix = Gtk.Gdk.pixbuf_new_from_file("~/Dektop/GTK/images/test1-fix.jpg")
補足情報(FW/ツールのバージョンなど)
https://github.com/enesates/PyOpenCV/blob/master/pyopencv.py
https://python-gtk-3-tutorial.readthedocs.io/en/latest/iconview.html?highlight=gdk.pixbuf
ここの2つを元にプログラムを書きました。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/12/10 16:14
2018/12/10 22:45
退会済みユーザー
2018/12/11 01:54
2018/12/11 12:04
退会済みユーザー
2018/12/12 02:55