# Gtk does not work well in VSCode

**URL:** https://discourse.julialang.org/t/gtk-does-not-work-well-in-vscode/128024
**Category:** General Usage
**Tags:** question
**Created:** [April 13, 2025, 12:25pm UTC](https://discourse.julialang.org/t/gtk-does-not-work-well-in-vscode/128024 "2025-04-13T12:25:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![gangchern](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gangchern/32/13298_2.png) [@gangchern](https://discourse.julialang.org/u/gangchern)
#### Post date: [April 13, 2025, 12:25pm UTC](https://discourse.julialang.org/t/gtk-does-not-work-well-in-vscode/128024/1 "2025-04-13T12:25:44Z")

</div>

Anybody try Gtk.jl, It works well in Jupyter . But when I try it in VSCode, it generate some errors.

```julia
using Gtk

Gtk.init()

# Create a main window
win = GtkWindow("TextField and Button Example", 300, 100)

# Handle the window close event properly
signal_connect(win, "destroy") do widget
    Gtk.quit()
end

# Show the window
showall(win)

# Run the Gtk event loop to keep the window open
Gtk.gtk_main()

```

It show errors in Base.jl

Exception has occurred: UndefVarError  
UndefVarError: `init` not defined in `Gtk`

Stacktrace:  
[1] getproperty(x::Module, f::Symbol)  
@ Base Base.jl:42  
[2] top-level scope

---

<div class="post-metadata">

### Author: ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)
#### Post date: [April 13, 2025, 5:29pm UTC](https://discourse.julialang.org/t/gtk-does-not-work-well-in-vscode/128024/2 "2025-04-13T17:29:38Z")

</div>

The issue isn’t in `Base.jl`, that error is just saying the `Gtk` module doesn’t have the `init` name at runtime you expected. My first guess would be that you’re using different versions of Gtk.jl, and `init` was removed for one of them. It suggests you move to Gtk4.jl because it’s no longer supported, so you should do that if you don’t need to reproduce old code.
