How to get position of main GIMP window? - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +--- Thread: How to get position of main GIMP window? (/Thread-How-to-get-position-of-main-GIMP-window) |
How to get position of main GIMP window? - sunslick - 11-09-2017 I am trying to position a dialogbox relative to the main GIMP window (using Python-fu) 1. I load a file in GIMP as follows first_file = os.path.join(PathToProcess, filename) img = pdb.gimp_file_load(first_file,first_file) 2. I try to get the position of the file as follows wdw = gtk.Window(gtk.WINDOW_TOPLEVEL) xm,ym = wdw.get_position() xm, ym returns as 0,0. I have tried different ways to reference the main GIMP window, but it does not seem to work. How should I get the position of the main GIMP window (with my file opened) on the desktop ? RE: How to get position of main GIMP window? - Ofnuts - 11-09-2017 When you do a gimp_file_load() there is no window created (because if very many case you apply a processing, save, and exit.... If you want a window you have to create a Display: Code: window=gimp.Display(image) Remember also that the python plugin runs in its own separate process, so you can't use calls that only deal with the window of your process. However, the general philosophy of the scripts/plugins is that they are meant for processing and not to tweak the UI. So you will be doing things that may conflict with Gimp's UI (for instance, you can't even tell if you are in single-window mode, in which case your TOP LEVEL window is going to be the same for all). Another bit of Gimp's UI philosophy is that you try to make a best guess for the position the first time your create the dialog, but more importantly save the position for further uses. This covers the case of people with two monitors, one for the image and one for the controls (your dialog will open on the wrong monitor only once). RE: How to get position of main GIMP window? - sunslick - 11-10-2017 Undestood. That helps. Is it possible to get the position and the size of the main GIMP window (i.e. the main GIMP GUI) ? That is where the image opens (using the method I am using) RE: How to get position of main GIMP window? - Ofnuts - 11-10-2017 No, unless there is a GTK call to enumerate all the desktop Windows. But if you are in multi-window mode things will be complicated. |