-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
position a gui element in corner of windows - track resizes? #243
Comments
Good point. I see there's a TODO in DisplayOpenGL on that subject. It's probably rather difficult to do in your code as it needs an additional event mask setting up in DisplayOpenGL and the event checking in Display needs to catch resizes. i.e. DisplayOpenGL xlib.XSelectInput(self.d, self.window, KeyPressMask | KeyReleaseMask | ResizeRedirectMask) and Display n = xlib.XEventsQueued(self.opengl.d, xlib.QueuedAfterFlush)
for _ in range(n):
xlib.XNextEvent(self.opengl.d, self.ev)
if self.ev.type == KeyPress or self.ev.type == KeyRelease:
self.event_list.append(self.ev)
elif self.ev.type == ClientMessage:
if (self.ev.xclient.data.l[0] == self.opengl.WM_DELETE_WINDOW.value):
self.destroy()
elif self.ev.type == ResizeRequest:
(self.width, self.height) = (self.ev.xresizerequest.width,
self.ev.xresizerequest.height)
opengles.glViewport(0, 0, self.width, self.height)
self.was_resized = True then in programs if DISPLAY.was_resized:
# move shapes and fix camera However the the normal Camera.reset() with different lens settings doesn't work properly and creating new Cameras and setting Paddy PS to answer the first part of your question. You can get the Display size using its ...
button.positionX((display.width - bw) * 0.5)
button.positionY((diplay.height - bh) * 0.5) |
Many thanks, that'll keep me going |
I want to position a couple of buttons in the window corners, and reposition them if the user resizes the window, but I can't see how to find the window's size, or detect when it is resized.
The text was updated successfully, but these errors were encountered: