GTK:获取窗口中鼠标单击的坐标

发布于 2024-09-14 09:00:06 字数 58 浏览 0 评论 0原文

在 GTK 中,我无法弄清楚要设置什么回调,以便当用户在窗口中单击时,我可以获得单击的 X/Y 坐标。

In GTK I can't figure out what callback to setup so that when the user clicks in a window, I can get the X/Y co-ords of the click.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愿与i 2024-09-21 09:00:06

您正在寻找按钮-press-event GtkWidget 信号。

You're looking for the button-press-event signal of GtkWidget.

调妓 2024-09-21 09:00:06

回调中的事件参数通常获取 ax 和 ay 成员,它们是鼠标坐标。如果您需要示例,请查看 gtk 教程,其中有一个小型绘图程序的示例代码,您可以在其中了解如何处理鼠标事件

http://www.gtk.org/tutorial1.2/gtk_tut-23.html

The event param in the call back usually get's a x and a y member which are the mouse coordinates. If you need an example have a look at the gtk tutorial, there is the example code of a small drawing program, where you can see how to handle mouse events

http://www.gtk.org/tutorial1.2/gtk_tut-23.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文