简体   繁体   English

Python和Gtk - 正在使用哪个GTK版本?

[英]Python and Gtk - which GTK version is being used?

from gi.repository import Gtk

#print Gtk.GTK_MAJOR_VERSION

win = Gtk.Window()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()

That is my code, how can I know which version of Gtk is being used. 这是我的代码,我怎么知道正在使用哪个版本的Gtk。

Thank you! 谢谢!

You can use the following functions to get the version information: 您可以使用以下函数来获取版本信息:

Gtk.get_major_version()
Gtk.get_minor_version()
Gtk.get_micro_version()

For check in .gir files: 用于签入.gir文件:

grep -rin 'get_[a-zA-Z]*_version' /usr/share/gir-1.0/Gtk-3.0.gir

Example output: 示例输出:

grep -rin 'get_[a-zA-Z]*_version' /usr/share/gir-1.0/Gtk-3.0.gir
108409:    <function name="get_major_version"
108410:              c:identifier="gtk_get_major_version"
108424:    <function name="get_micro_version"
108425:              c:identifier="gtk_get_micro_version"
108439:    <function name="get_minor_version"
108440:              c:identifier="gtk_get_minor_version"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM