Python3中有gi.repository.Gtk的许多错误

问题描述 投票:0回答:1

我刚刚从Fedora 30升级到Fedora32。我所有的python东西都停止了工作。第一个问题是

import gtk

我读到我应该将其切换到

from gi.repository import Gtk as gtk
from gi.repository import Gdk

但是不存在许多模块。例如:

AttributeError: 'gi.repository.Gtk' object has no attribute 'combo_box_new_text'
AttributeError: 'gi.repository.Gtk' object has no attribute 'WINDOW_TOPLEVEL'
AttributeError: 'gi.repository.Gtk' object has no attribute 'settings_get_for_screen'

一团糟。

我该如何解决?

python-3.x linux gtk
1个回答
0
投票

使用Gtk 3:

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
© www.soinside.com 2019 - 2024. All rights reserved.