gWidgets(john verzani)とRgtk2を組み合わせたいと思います。 これは誰でもパラダイムとして使うことができます。次のようにR:Rgtk2:gwidgets:gWidgetsRGtk2
アルゴリズムである: ステップ1:gwindowを構築(またはgframe) ステップ2:構築GTKスクロールテキストビュー ステップ3:gwidgetに最後に換算 ステップ4:にそれを追加します
私が直面している問題はGTKのスクロール可能なテキストビューであるのに対し、これは正しい考え方であるかどうか疑問です 私はスクロールバーを動作させることができません。
次のようにRのコードは次のとおりです。私はGTKスクロール可能なウィンドウを使用したくない
###########################
# load libraries
library(RGtk2)
library(gWidgets)
library(gWidgetsRGtk2)
# data set
x <- c(1:9)
y <- c(10:19)
z <- c(20:29)
df <- data.frame(x, y, z)
df.co <- capture.output(df)
###########################
# STEP 1, library(gWidgets)
# Construct a gwindow (or a gframe)
G.Window <- gwindow()
###########################
# STEP 2, library(RGtk2)
# Construct a GTK scrollable text view
Gtk.Text.View <- gtkTextViewNew(show = TRUE)
# create a table to attach the scrollbars
Gtk.Table.New <- gtkTableNew(2, 2, show = TRUE)
# construct the scrollbars
Gtk.H <- gtkHScrollbarNew()
Gtk.V <- gtkVScrollbarNew()
# attach the text view and the scrollbars to the table
gtkTableAttach(Gtk.Table.New, Gtk.Text.View, 0, 1, 0, 1)
gtkTableAttach(Gtk.Table.New, Gtk.H, 0, 1, 1, 2)
gtkTableAttach(Gtk.Table.New, Gtk.V, 1, 2, 0, 1)
# The scrollbars are not functional, for now.
# So I thought of constructing a viewport.
# The problem I face is that I cannot make the scrollbars work.
Gtk.Viewport <- gtkViewportNew()
###########################
# STEP 3, library(gWidgetsRGtk2)
# Convert the table into a gwidget
G.Table.View <- as.gWidgetsRGtk2(Gtk.Table.New)
###########################
# STEP 4, library(gWidgets)
# Add the table into the gwindow (or into the gframe)
add(G.Window, Gtk.Table.New)
# STEP 5, make the buffer management
Gtk.Text.View.Get.Buffer <- gtkTextViewGetBuffer(Gtk.Text.View)
for (i in 1:length(df.co))
{
Gtk.Text.Buffer.Get.Bounds <- gtkTextBufferGetBounds(Gtk.Text.View.Get.Buffer)
Gtk.Text.Buffer.Insert <- gtkTextBufferInsert(Gtk.Text.View.Get.Buffer, iter=Gtk.Text.Buffer.Get.Bounds$end, text=paste(df.co[i], "\n", sep="", collapse=""), len=-1)
}
###########################
それがgWidget、 に変換した後、私はGTKのテキスト/テーブルウィジェットをしたいので、ウィンドウ(gWidget)にも入力します。
これがstackoverflowの対象でない場合は、お詫び申し上げます。事前にありがとう
私はあなたの答えに本当に義務づけられています。大いに感謝する。アポストロス –