For Tk, you can also do something like this:

```
using Tk

w = Toplevel("title", 400, 300)
Tk.set_size(w, 400, 300)
tcl("tkwait", "window", w)
```

With OS X, this seems to wait until the main window is dismissed.


On Saturday, August 29, 2015 at 2:54:50 PM UTC-4, Tim Holy wrote:
>
> For Gtk: 
> https://github.com/JuliaLang/Gtk.jl#usage-without-the-repl 
>
> On Saturday, August 29, 2015 11:43:35 AM andrew cooke wrote: 
> > ah thanks.  didn't think it would be an open issue. 
> > 
> > On Saturday, 29 August 2015 15:12:34 UTC-3, Isaiah wrote: 
> > > Tk.jl only polls right now (see 
> > > https://github.com/JuliaLang/Tk.jl/issues/3) so you just need to do 
> > > something to prevent the process from exiting, such as calling 
> > > `readline()`, or 
> > > 
> > > while running 
> > > 
> > >   yield() 
> > > 
> > > end 
> > > 
> > > (obviously with some hook somewhere that changes the state) 
> > > 
> > > On Sat, Aug 29, 2015 at 1:43 PM, andrew cooke <[email protected] 
> > > 
> > > <javascript:>> wrote: 
> > >> I guess I need to clarify. 
> > >> 
> > >> If can successfully run Cairo and Tk commands in a window so that 
> > >> "something" is displayed fine. 
> > >> 
> > >> But if I put this in a file and execute it, the program finishes and 
> > >> exits (as one would expect). 
> > >> 
> > >> In most GUI packages that I have used in the past, however, there is 
> a 
> > >> way to "enter the main event loop" of the GUI, so that the program 
> does 
> > >> not 
> > >> exit, but continues displaying the windows on the screen and 
> responding 
> > >> to 
> > >> user events.  How do I do that with Tk? 
> > >> 
> > >> Andrew 
> > >> 
> > >> On Friday, 28 August 2015 15:03:49 UTC-3, j verzani wrote: 
> > >>> I'm not sure the window disappears. For me the size gets set to 1 
> pixel 
> > >>> by 1 pixel, and so is not visible. This command resizes: 
> > >>> `Tk.set_size(win, 
> > >>> 300, 300)`, which makes the window visible for me. 
> > >>> 
> > >>> On Friday, August 28, 2015 at 12:47:03 PM UTC-4, andrew cooke wrote: 
> > >>>> How do I make TK windows sit there while I look at them?  At the 
> > >>>> moment, I have code, based on 
> > >>>> http://julialang.org/blog/2013/05/graphical-user-interfaces-part2/ 
> > >>>> that flashes a window on the screen, but then the program finishes 
> and 
> > >>>> the 
> > >>>> window disappears. 
> > >>>> 
> > >>>> I could add a "while true", but I assume there's some Tk function I 
> > >>>> call that "takes over" until the user kills the window? 
> > >>>> 
> > >>>> Thanks, 
> > >>>> Andrew 
>
>

Reply via email to