Re: Class and resizable

72 views
Skip to first unread message

Andre D

unread,
Aug 5, 2012, 6:42:59 PM8/5/12
to pyglet...@googlegroups.com
I am unsure what you mean by "class form". Do you mean a window class
which is resizeable?

you should be either able to put

self.resizable = True in the constructor, or in the class definition
just put resizable=True


On Sun, Aug 5, 2012 at 11:13 AM, onur tuna <onurt...@gmail.com> wrote:
> Hi, i have tried to use "window.resizable=True" statement in the class form.
> Anyone knows about it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyglet-users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/pyglet-users/-/AkvP_u7un1YJ.
> To post to this group, send email to pyglet...@googlegroups.com.
> To unsubscribe from this group, send email to
> pyglet-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/pyglet-users?hl=en.

onur tuna

unread,
Aug 6, 2012, 2:40:54 AM8/6/12
to pyglet...@googlegroups.com
You understood what I mean. I am in trouble with English. I have tried your solution before. It gives error.

Thanks

2012/8/6 Andre D <an...@andred.ca>

Andre D

unread,
Aug 6, 2012, 10:50:25 AM8/6/12
to pyglet...@googlegroups.com
what was the error?

onur tuna

unread,
Aug 6, 2012, 4:17:31 PM8/6/12
to pyglet...@googlegroups.com
I am giving a sample code and the error.

Code:

import pyglet

class Resize(pyglet.window.Window):
    def __init__(self):
        super(Resize, self).__init__()

        self.label = pyglet.text.Label('Resize now', x=10,y=20)
        self.resizable=True

    def on_draw(self):
        self.clear()
        self.label.draw()

if __name__ == '__main__':
    window = Resize()
    pyglet.app.run()

Error:

/usr/bin/python -u  "/home/onur/Desktop/Lessons/OpenGL/size.py"
Traceback (most recent call last):
  File "/home/onur/Desktop/Lessons/OpenGL/size.py", line 15, in <module>
    window = Resize()
  File "/home/onur/Desktop/Lessons/OpenGL/size.py", line 8, in __init__
    self.resizable=True
AttributeError: can't set attribute

Joe Esposito

unread,
Aug 6, 2012, 4:23:33 PM8/6/12
to pyglet...@googlegroups.com
Try setting resizable in the base constructor call instead.

Instead of:
    
    self.resizable=True
    

Do this:
    
    super(Resize, self).__init__(resizable=True)
    

onur tuna

unread,
Aug 6, 2012, 4:27:44 PM8/6/12
to pyglet...@googlegroups.com
OK. Thanks, it works.

2012/8/6 Joe Esposito <esp...@gmail.com>

shavais

unread,
Dec 11, 2012, 9:31:28 AM12/11/12
to pyglet...@googlegroups.com
Hello,

Today is

Tuesday, 12/11/2012.

The current release of Pyglet is

Pyglet 1.1.4.

I'm running:

OSX 10.6.8 (Snow Leopard)
Python 2.7.1
gcc 4.2.1.

I tried downloading the current release of pyglet, but the basic
tutorial sample..

----
window = pyglet.window.Window()

label = pyglet.text.Label(
'Hello, world',
font_name = 'Times New Roman',
font_size = 36,
x = window.width//2,
y = window.height//2,
anchor_x = 'center',
anchor_y = 'center'
)

@window.event
def on_draw():
window.clear()
label.draw()

pyglet.app.run()
----

..bombed out, it wasn't able to create a window. It seemed to be some
kind of OS library level mismatch; some carbon call was missing.

Googling revealed relatively recent commentary in a thread about the
problem, where some people talked about resolving it by using the
"homebrew" version (?) of Python rather than the system bundled
version. They also mentioned that pyglet under OSX depends on
carbon rather than cocoa, and uses 32 bit stuff.

I looked at the source code for the current release (1.1.4), and saw that
under OSX it does indeed appear to use carbon and so on (if "darwin" is
the platform name string.. a bit odd that that would be so, under 10.6.8,
but it must be, somehow, since the error message mentioned carbon
multiple times), so I downloaded and installed the development version
(current trunk, I guess?) of Pyglet.

Even with the system-bundled Python, on OSX 10.6.8, the development
release of Pyglet successfully creates a window, but it's not user-
resizeable.

After looking at some documentation, I tried passing in resizeable=True
to the window constructor, like this:

window = pyglet.window.Window(resizable = True)

..but this still does not result in a user-resizable window. There's no
scrollbar on the right, and no resize-handle at the lower right (and
hovering or clicking and dragging the mouse down there is fruitless).

I also tried this code:

platform = pyglet.window.get_platform()
display = platform.get_default_display()
screen = display.get_default_screen()
config = screen.get_best_config()
window = pyglet.window.Window(config = config, resizable = True)

..but that still didn't result in a user-resizable window. I also tried
setting the minimum and maximum size, but that didn't help.

I searched the documentation for anything relevant to controlling
whether or not that right hand scrollbar appears, but didn't find
anything.

I notice also that right clicking on the dock icon and clicking on "Quit"
does not close the program / window. (I guess I must need to respond
to a window event to get Quit working?)

Thanks for any help,

Shavais



shavais

unread,
Dec 11, 2012, 5:05:59 PM12/11/12
to pyglet...@googlegroups.com
shavais <shavais <at> gmail.com> writes:

I've discovered that if I get the mouse in just the right spot, I can resize
the window. So it's just that the scrollbar isn't there and the resize
handle isn't visible. I guess the pyglet philosophy would be to render
our own.

But right clicking on the dock icon and choosing "quit" does not exit
the program, while option-Q works as does clicking on the program's
main menu and choosing "quit".


Nathan

unread,
Dec 11, 2012, 6:28:13 PM12/11/12
to pyglet...@googlegroups.com
shavais,

you'll also have better luck if you use the more recent release of pyglet (1.2alpha or the 1.2 development version from the repository).

~ Nathan


Reply all
Reply to author
Forward
0 new messages