how can i change the shape mouse cursor in gWidgets RGtk2?

拥有回忆 提交于 2020-01-11 10:03:46

问题


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")

but this not works


回答1:


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)


来源:https://stackoverflow.com/questions/17309532/how-can-i-change-the-shape-mouse-cursor-in-gwidgets-rgtk2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!