1. EuGTK - size, position of a GtkWindow
- Posted by Jerry_Story Oct 26, 2010
- 1680 views
How do you get the width, height, x position, y position of a GtkWindow?
In GtkRoutines.e, under control[GtkWindow], I found
{"get_position",{P,I,I}},
{"get_size",{P,I,I}},
s = get(win,"size") printf(1,"size of window: width=%d height=%d \n",{s[1],s[2]}) s = get(win,"position") printf(1,"position of window: x=%d y=%d \n \n",{s[1],s[2]})
This produces nothing but zeros.
grep size *.ex
This produces lots of lines with 'set' and 'size' but none with 'get' and 'size'.
grep position *.ex
Same deal here. Lots of lines with 'set' and 'position' but none with 'get' and 'position'.
get_size() doesn't work on a GtkWindow.
2. Re: EuGTK - size, position of a GtkWindow
- Posted by jimcbrown (admin) Oct 26, 2010
- 1692 views
How do you get the width, height, x position, y position of a GtkWindow?
The best way to do this is probably to get get_geometry() of GdkWindow, http://www.pygtk.org/docs/pygtk/class-gdkwindow.html#method-gdkwindow--get-geometry
You'll need to obtain the GdkWindow of your GtkWindow first.
There is a get_position() method for GtkWindows. http://www.pygtk.org/docs/pygtk/class-gtkwindow.html#method-gtkwindow--get-position
You can also use the get_origin() method for GdkWindows, http://www.pygtk.org/docs/pygtk/class-gdkwindow.html#method-gdkwindow--get-origin
get_size() doesn't work on a GtkWindow.
It should work. See http://www.pygtk.org/docs/pygtk/class-gtkwindow.html#method-gtkwindow--get-size (note that some caveats of get_size() on a GtkWindow are stated in this link, and look at the mention of configure_event).
GdkWindow has its own get_position as well, http://www.pygtk.org/docs/pygtk/class-gdkwindow.html#method-gdkwindow--get-position
3. Re: EuGTK - size, position of a GtkWindow
- Posted by irv Oct 26, 2010
- 1591 views
both get(...,"position") and get(...,"default size") used to work ok. Somewhere along the line, that got broken. Give me a day to figure out where, and I'll have a fix for it.
However, I wonder if get("default size") is what you really want to get. All that does is return the size your window was originally shown at, not the current size (if the user has resized it).
4. Re: EuGTK - size, position of a GtkWindow
- Posted by Jerry_Story Oct 26, 2010
- 1538 views
However, I wonder if get("default size") is what you really want to get. All that does is return the size your window was originally shown at, not the current size (if the user has resized it).
The program has 3 windows. (doing it the Linux way instead of the Windows way ) The user will be able to adjust the x,y position and the w,h size of each of the 3 windows. The x,y position and the w,h size of each window will be remembered in 'dmak_size.ini' on quit or on save settings, and on startup next time the file 'dmak_size.ini' will be read.
5. Re: EuGTK - size, position of a GtkWindow
- Posted by irv Oct 26, 2010
- 1505 views
OK, I've got those 3 calls working now, but I want to see if there are other similar calls which also got broken. Give me a day or 2.
6. Re: EuGTK - size, position of a GtkWindow
- Posted by irv Oct 27, 2010
- 1527 views
An updated version that works (unless fixing this broke something else :) version 2.4.6 SourceForge