如何在gWidgets RGtk2中更改形状的鼠标光标? [英] how can i change the shape mouse cursor in gWidgets RGtk2?

查看:137
本文介绍了如何在gWidgets RGtk2中更改形状的鼠标光标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gWidgets中ggraphics的绘图区域中,将鼠标光标更改为"GDK_TCROSS",但我希望使用与gwindow"GDK_LEFT_PTR"相同的鼠标光标:

In a Drawing Area of ggraphics in gWidgets changes the mouse cursor to "GDK_TCROSS",but i want the same mouse cursor of the gwindow "GDK_LEFT_PTR":

 library(gWidgets)
 library(gWidgetsRGtk2)
 library(RGtk2)
 options(guiToolkit = "RGtk2")
 w=gwindow("")
 g=ggraphics(cont=w,no_popup=T,do.rubber.banding = F)
 plot(x,y)
 c=gdkCursorNew("GDK_TOP_LEFT_ARROW")
 getToolkitWidget(g)$ModifyCursor(c)

  or

 gtkWidgetModifyCursor(getToolkitWidget(g),"GDK_TCROSS","GDK_LEFT_PTR")

但这不起作用

推荐答案

gtkWidgetModifyCursor修改光标的颜色.您需要通过gdkWindowSetCursor设置光标.为此,您需要获取与小部件关联的窗口:

gtkWidgetModifyCursor modifies the colors of the cursor. You need to set the cursor through gdkWindowSetCursor. For that you need to grab the window associated with the widget:

getToolkitWidget(g)$getWindow()$setCursor(c)

这篇关于如何在gWidgets RGtk2中更改形状的鼠标光标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆