Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

julia - 朱莉娅gui显示图像gtk.jl(Julia gui display an image gtk.jl)

How can I display an image using Gtk with Julia?

(如何使用Gtk和Julia显示图像?)

In my GUI, I have a button set up so when I click the button, my program will show the image in the GUI?

(在我的GUI中,我设置了一个按钮,因此当我单击该按钮时,我的程序将在GUI中显示图像吗?)

I haven't found any documentation about it on the official Gtk.jl Docs .

(我尚未在官方的Gtk.jl Docs中找到任何有关它的文档 。)

  ask by Mahmut215 translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

this should do the trick!

(这应该可以解决问题!)

using Gtk

win = GtkWindow("My First Gtk.jl Program", 400, 200)

a = GtkImage("path_to_image_file")

push!(win,a)

showall(win)

Note that I am not sure if it can render in the same window as the button you mentioned since I get the following error when I have a button and then push the image:

(请注意,我不确定它是否可以与您提到的按钮在同一窗口中呈现,因为当我有一个按钮然后按下图像时出现以下错误:)

(<unknown>:69811): Gtk-WARNING **: 15:34:18.724: Attempting to add a widget with type GtkImage to a GtkWindow, but as a GtkBin subclass a GtkWindow can only contain one widget at a time; it already contains a widget of type GtkButton

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...