0
私はPYGObjectsを使ってpython gtk 3の定数を探しています。具体的には、スクロールイベントの列挙定数は何ですか? 'gi.repository.Gdk'オブジェクトには属性 'SCROLL_UP'がありません。イベントはhereと表示されており、動作していませんpygi-convert.sh 問題を特定するサンプルコードが含まれています。ありがとう。スクロールイベントのgtk 3のpython定数は何ですか?
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk
def on_destroy (widget):
Gtk.main_quit()
return False
def scroll_notify_event(w, e):
print e.direction
if e.direction == Gdk.ScrollDirection.UP:
print "You scrolled up"
elif e.direction == Gdk.ScrollDirection.DOWN:
print "You scrolled down"
def event(eventbox, event):
print("Event: %s" % event)
def create():
window = Gtk.Window()
window.connect("destroy", on_destroy)
window.add_events(Gdk.EventMask.SCROLL_MASK)
eventbox = Gtk.EventBox()
eventbox.connect("event", event)
window.connect('scroll-event', scroll_notify_event)
window.add(eventbox)
window.show_all()
if __name__ == '__main__':
create()
Gtk.main()
スクロールイベントのドキュメントの場所[ここ](https://lazka.github.io/pgi-docs/#Gdk-3.0/enums.html#Gdk.ScrollDirection.UP)が見つかりました。 –