[ase-users] Updating the gui window without opening a new window?
Ask Hjorth Larsen
asklarsen at gmail.com
Wed Jul 4 13:53:49 CEST 2018
Hi Colin,
2018-02-07 17:56 GMT+01:00 Colin Bousige <colin.bousige at gmail.com>:
> Hi Ask,
>
> And thanks a lot for your answer.
>
> What I want to do is a user-friendly tool with tkinter to build a specific
> structure with some parameters that the user enters.
> Then I want the resulting structure to be displayed, and update this display
> as the user changes the parameters – the slab was just an example.
Did you find a solution to this?
There's an MR here which makes this possible:
https://gitlab.com/ase/ase/merge_requests/879
It also adds an example to the docs.
>
> So I guess a solution for this would be either:
> - a way to trigger a gui update on demand or as it detects a change in the
> structure
You should be able to launch the GUI as a subprocess, then monitor
e.g. a file (or stdin) for updates. Or monitor an Atoms object
directly if you use threading/multiprocessing.
> - or display the gui as a frame within my tkinter app?
Someone would need to try and see if it works, or what needs to be done.
Best regards
Ask
> - or maybe just a way to close the gui window and then open a new one with
> view()
> - or develop my app as an ASE plugin – which I would like avoiding doing...
>
> And concerning edit(), it only results in crashing my python session, so I
> don’t know what I can do with it…
> I use Anaconda python 3.6.2 on OSX and installed ASE with 'conda install -c
> conda-forge ase'.
>
> Thanks a lot,
> Colin
>
> On 7 Feb 2018, at 17:15, Ask Hjorth Larsen <asklarsen at gmail.com> wrote:
>
> Hi Colin,
>
> 2018-02-06 15:11 GMT+01:00 Colin Bousige via ase-users
> <ase-users at listserv.fysik.dtu.dk>:
>
> Hi,
>
> I am building a tool to easily construct some structure using tkinter to
> input some values and ase to show the resulting structure.
>
> My question is: how do you update the gui window with a modified structure
> *without* opening a new window ?
>
> Here is a short example showing my problem:
>
> ```python
> from ase import Atoms
> from ase.visualize import view
> from ase.build import fcc111
>
> slab = fcc111('Ag', size=(5,6,1), a=4, orthogonal=True)
> view(slab)
> # now we modify this slab (in my case this is done via tkinter where eg. the
> user can set size=(i,j,k))
> slab = fcc111('Ag', size=(5,6,3), a=4, orthogonal=True)
> view(slab) # Here I would like the view of the structure to be updated as I
> change it, and not open a new gui window
> ```
>
>
> The 'view' command always opens a new process.
>
> I don't completely understand what you need to do - the slab is
> modified by the user, yet you later replace it?
>
> You may wish to try slab.edit().
>
> Best regards
> Ask
>
>
>
> Thanks in advance for your help,
> Colin
> _______________________________________________
> ase-users mailing list
> ase-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
>
More information about the ase-users
mailing list