问题
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