# Interface to wxwidgets?

**URL:** <https://discourse.julialang.org/t/interface-to-wxwidgets/23152>\
**Category:** General Usage\
**Created:** [April 15, 2019, 3:44am UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152 "2019-04-15T03:44:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [April 15, 2019, 3:44am UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152/1 "2019-04-15T03:44:27Z")

</div>

Just how bad would it be to implement this ? It looks like a daunting task.

However there is a complete, very mature, python interface and I was kind of hoping that the work done there might make it more tractable.

however, I’ve been looking through the pywxwidget code and I don’t believe it would help reduce the amount of work involved in the actual generation of the interface code. It would help tremendously in understanding how it should be structured, which is no small matter.

Just thought I’d check with those more knowledgeable about it before I abandon the idea…

Thanks,

p.s. of course if 4 or 5 people volunteered to help out then it might be more reasonable… 😉

---

<div class="post-metadata">

**Author:** ![lobingera](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lobingera/32/211_2.png) [@lobingera](https://discourse.julialang.org/u/lobingera)\
**Post date:** [April 15, 2019, 8:26am UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152/2 "2019-04-15T08:26:42Z")

</div>

Gtk.jl isn’t matching your requirements?

---

<div class="post-metadata">

**Author:** ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Post date:** [April 15, 2019, 12:31pm UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152/3 "2019-04-15T12:31:18Z")

</div>

wxwidgets it written in C++, mich makes it much harder to wrap it in Julia than a plain C library like Gtk. Gtk actually is nowadays quite cross-platform (not perfect but ok) and I am using Gtk.jl on all three platforms on a regular basis.

It would be extremely cool if we could convince you to contribute to Gtk.jl if you are interested in a windowing toolkit 😉

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [April 15, 2019, 5:30pm UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152/4 "2019-04-15T17:30:04Z")

</div>

yes, clearly the fact that wxwidgets is a c++ library makes things harder, hence the reason for my question …

your comment is about cross-platform is very helpful. I have to be able to run this code on windows even though I’ll develop it all under linux.

“they” have said that it can be problematic to get gtk working properly under windows. I have run some simple julia/gtk experiments and things seem to be ok.

> [@tobias.knopp](#):
>
> It would be extremely cool if we could convince you to contribute to Gtk.jl if you are interested in a windowing toolkit

I really should have just started out in Gtk and see how it works (instead of proposing a difficult project). as you say, better to do that and help with the julia-gtk than trying to port a complicated library.

One thing i’m very interested in, as it is my short term focus is the gtk canvas. the it seems as though the gtk2 canvas is maybe deprecated. or at least it seems to have dissappeared in gtk3.

also the julia has the following warning:

> Errors in the `draw` function can corrupt Gtk’s internal state; if this happens, you have to quit julia and start a fresh session. To avoid this problem, the `@guarded` macro wraps your code in a `try/catch` block and prevents the corruption.

which looks a bit scary.

So i was thinking about writing a canvas like interface in julia which i think is probably more useful in the long term as it will be easy to extend and modify.

Thanks very much. hopefully I will be able to contribute.

---

<div class="post-metadata">

**Author:** ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Post date:** [April 15, 2019, 5:40pm UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152/5 "2019-04-15T17:40:29Z")

</div>

With gtk3 the canvas has been replaced by Cairo, which is a high quality 2D canvas library. Cairo is wrapped in the Cairo.jl package.

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [April 15, 2019, 11:34pm UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152/6 "2019-04-15T23:34:41Z")

</div>

oh. thanks for explaining that. I know all about Cairo of course, I have used it frequently, I had no idea it was supposed to be the canvas replacement.

So I should just be able to create a cairo widget/surface and write my graphics into it, right ?

I know what I will be doing tonight 🙂

---

<div class="post-metadata">

**Author:** ![tobias.knopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tobias.knopp/32/7551_2.png) [@tobias.knopp](https://discourse.julialang.org/u/tobias.knopp)\
**Post date:** [April 15, 2019, 11:43pm UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152/7 "2019-04-15T23:43:13Z")

</div>

yes right. Have a look at this example:

[http://juliagraphics.github.io/Gtk.jl/latest/manual/canvas.html](http://juliagraphics.github.io/Gtk.jl/latest/manual/canvas.html)

The `GtkCanvas` is actually not a real Gtk thing but a custom Julia type that holds the cairo surface and acts as the GtkDrawingArea

> <https://github.com/JuliaGraphics/Gtk.jl/blob/master/src/cairo.jl#L4>

Don’t expect Gtk to be fully maintained but since I use it in a large code base, I keep it up running.

---

<div class="post-metadata">

**Author:** ![purplishrock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/purplishrock/32/13451_2.png) [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Post date:** [April 15, 2019, 11:50pm UTC](https://discourse.julialang.org/t/interface-to-wxwidgets/23152/8 "2019-04-15T23:50:16Z")

</div>

Great! Thanks again.

Hopefully I will be able to help out.

I _really_ need a simple interactive drawing tool, it seems like Gtk should do the job nicely.
