You are not logged in.
Pages: 1
http://www.pygtk.org/docs/pygtk/class-gtkeventbox.html
Python is just an example.
So .. is there any way to get EventBox (or its child) width?
Is there any way for it to be updated on window resize?
• WM: Openbox
• Resolution: 1366x768
• CPU: CPU: Intel Pentium CPU B980 @ 2.4GHz
• RAM: 2931MB
Offline
As you say "Python is just an example" and I am only familiar with GTK's C bindings, I looked up the C documentation. There are numerous functions on this page that should do what you want: https://developer.gnome.org/gtk3/stable/GtkWidget.html
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
Thank you!
Python was really just an example and the reason is .. it was the first link in Google.
I'm actually targeting C as well.
I have seen the page you linked to, but I still don't see how would I get the width of EventBox or GtkWidget after the window has been reiszed AND without setting widgets default (requested) size, which obviously doesn't equal the one after I've resized the window (and the given widget/eventbox).
Any tips?
I've seriously spent about an hour on this just by Googling for a possible solution, but found nothing.
For a better understanding of what I'm trying to achieve - I'm trying to create a progress bar and have a possibility to click on it to change it's value. In other words, a music players progress bar and seeking option.
At the moment I can get the click x coordinates and default EventBox width, BUT as soon as I resize the window, EventBox width doesn't change and therefore I get an incorrent x value.
Last edited by GE (2014-01-11 00:51:27)
• WM: Openbox
• Resolution: 1366x768
• CPU: CPU: Intel Pentium CPU B980 @ 2.4GHz
• RAM: 2931MB
Offline
I'm not really into gtk and I don't use the C bindings, but according to the docs I'd say:
int gtk_widget_get_allocated_width(GtkWidget*) ?
Once again I'm a complete Gtk noob, but can't you catch events on the bar itself? If you really have to, you could grab the resize event of the bar and change the size of the eventbox above it too, but it sounds really hacky to me.
Offline
Steef435 is right, use on of these:
If you want to be notified when the size changes you should use the size-allocate signal of GtkWidget.
There is an example here:
http://stackoverflow.com/a/2676987/641662
Edit:
After reading your motivation of implementing a seekbar for a musicplayer, I've done this here, if it is of help (Python):
Output can be seen here (blue bar on top): here.
This one works without an EventBox though, just with a GtkDrawingArea.
Last edited by SahibBommelig (2014-01-11 21:03:43)
Offline
Pages: 1