Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ViralBShah authored Aug 12, 2024
1 parent de71f36 commit d66abbc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,18 @@
[docs-stable-url]: https://juliagraphics.github.io/Tk.jl

[issues-url]: https://github.com/JuliaGraphics/Tk.jl/issues

# A simple example

```julia
w = Toplevel("Example") ## A titled top level window
f = Frame(w, padding = [3,3,2,2], relief="groove") ## A Frame with some options set
pack(f, expand = true, fill = "both") ## using pack to manage the layout of f
#
b = Button(f, "Click for a message") ## Button constructor has convenience interface
grid(b, 1, 1) ## use grid to pack in b. 1,1 specifies location
#
callback(path) = Messagebox(w, title="A message", message="Hello World") ## A callback to open a message
bind(b, "command", callback) ## bind callback to 'command' option
bind(b, "<Return>", callback) ## press return key when button has focus
```

0 comments on commit d66abbc

Please sign in to comment.