[英]Embedding gnuplot 5 window into Gtkmm 3
I am trying to embed the gnuplot window into my application using the socket/plug concept in gtkmm 3 library. 我试图使用gtkmm 3库中的socket / plug概念将gnuplot窗口嵌入到我的应用程序中。 I have followed the example in the official page here and everything works as expected.
我在这里的官方页面上遵循了该示例,并且一切正常。
Then I moved to embedding gnuplot window. 然后我转到嵌入gnuplot窗口。 I modified the socket.cpp as follows:
我修改了socket.cpp如下:
#include <iostream>
#include <fstream>
#include <gtkmm.h>
#include <gtkmm/socket.h>
using namespace std;
class MySocketWindow : public Gtk::Window
{
public:
MySocketWindow()
{
auto socket = Gtk::manage(new Gtk::Socket());
add(*socket);
cout << "Socket id is: " << hex << socket->get_id() << endl;
show_all();
}
};
int main(int argc, char** argv)
{
auto app = Gtk::Application::create(argc, argv, "org.gtkmm.example.socket");
MySocketWindow win;
app->run(win);
return 0;
}
I compile/build the code with: 我用以下代码编译/构建代码:
g++ --std=c++11 socket.cpp -o socket `pkg-config gtkmm-3.0 --cflags --libs`
And run it. 并运行它。 A black socket window appears with
Socket id is 3e0000b
message printed on the terminal. 出现一个黑色的套接字窗口,终端上印有
Socket id is 3e0000b
消息。
.\socket
Then I run gnuplot in x11 terminal with the corresponding window id above: 然后我在x11终端中使用上面相应的窗口ID运行gnuplot:
Now when I plot sin(x)
in gnuplot, I am expecting the socket window to show the plot, but nothing happens. 现在,当我在gnuplot中
plot sin(x)
时,我期望套接字窗口显示该图,但是什么也没有发生。 What I am doing wrong here? 我在这里做错了什么?
I am running Ubuntu 16.04, 64-bit. 我正在运行64位的Ubuntu 16.04。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.