how can i change the shape mouse cursor in gWidget

2020-04-11 04:29发布

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

标签: r gwidgets
1条回答
放荡不羁爱自由
2楼-- · 2020-04-11 05:15

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)
查看更多
登录 后发表回答