1. EuGTK - size, position of a GtkWindow

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.

new topic     » topic index » view message » categorize

2. Re: EuGTK - size, position of a GtkWindow

Jerry_Story said...

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

Jerry_Story said...

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

new topic     » goto parent     » topic index » view message » categorize

3. Re: EuGTK - size, position of a GtkWindow

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).

new topic     » goto parent     » topic index » view message » categorize

4. Re: EuGTK - size, position of a GtkWindow

irv said...

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 smile ) 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.

new topic     » goto parent     » topic index » view message » categorize

5. Re: EuGTK - size, position of a GtkWindow

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.

new topic     » goto parent     » topic index » view message » categorize

6. Re: EuGTK - size, position of a GtkWindow

An updated version that works (unless fixing this broke something else :) version 2.4.6 SourceForge

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu