Re: Traditional full screen support with Alt+Tab?
Sorry I can't confirm it because I only have Linux boxes around at the moment. Hopefully someone with Windows can chime in here. I think there is probably some way to make this work. -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
Re: Traditional full screen support with Alt+Tab?
Oops I didn't look there in the docs, however looking at the limitations it lists: The following restrictions apply on Windows: - Most keys are not disabled: a user can still switch away from your application using Ctrl+Escape, Alt+Escape, the Windows key or Ctrl+Alt+Delete. *Only the Alt+Tab combination is disabled.* It looks like I won't be able to use this method to control it. Is there any way to get a traditional full screen that's not a full screen windowless border with OpenGL by chance? On Thursday, January 12, 2017 at 12:39:27 AM UTC-6, Benjamin Moran wrote: > > Ah, sorry, for some reason I read your post as "Alt+Enter". > > From a quick look at the docs, it shows that the > Window.set_exclusive_keyboard() mode will do what you want. > > > http://pyglet.readthedocs.io/en/pyglet-1.2-maintenance/programming_guide/keyboard.html?highlight=set_exclusive_keyboard#keyboard-exclusivity > > > > On Thursday, January 12, 2017 at 7:36:37 AM UTC+9, Charles wrote: >> >> Hey Benjamin, ALT + ENTER does work, just ALT + TAB doesn't. I'm thinking >> Windows switches out of the window pyglet gets a chance to see the >> keypresses. >> >> On Monday, January 9, 2017 at 1:11:07 AM UTC-6, Benjamin Moran wrote: >>> >>> Pyglet doesn't capture any keypresses by default, but I usually just add >>> the additional events like so: >>> @window.event >>> def on_key_press(key, mod): >>> if key == pyglet.window.key.ENTER and mod == pyglet.window.key. >>> MOD_ALT: >>> .. >>> .. >>> >>> if window.fullscreen is True: >>> window.set_fullscreen(fullscreen=False) >>> else: >>> window.set_fullscreen(fullscreen=True) >>> >>> >>> >>> >>> >>> On Monday, January 9, 2017 at 8:18:53 AM UTC+9, Charles wrote: It's been a while since I have been able to program again, however I just tried this and the alt tab combination is not actually registered by pyglet (Windows 7). On Saturday, December 3, 2016 at 4:46:37 PM UTC-6, magu...@gmail.com wrote: > > What you can do is capture the alt-tab keys and use > window.set_fullscreen(False) to return to the desktops native resolution, > then you could use window.minimize() to miminize it to the task bar or > just > leave it around. I've tried a few other approaches using > window.on_activate() and window.on_deactivate() for when the window gains > and looses focus, though I found the results were a little janky when it > came to scaling properly, others may be able to get better results. As it > stands in my current example when you tab back the window won't be in > fullscreen mode, but a simple alt+enter solves that. Example: > > import pyglet > from pyglet.window import key > from pyglet.gl import * > > class example(pyglet.window.Window): > def __init__(self): > super(example, self).__init__(640, 480, resizable=False, > fullscreen=True, caption="Test") > self.clear() > > #fullscreen aspect ratio > self.aspect = [self.width/640.0,self.height/480.0] > > pyglet.clock.get_fps() > self.fps_display = pyglet.clock.ClockDisplay() > > pyglet.clock.schedule_interval(self.update, .01) > > > def update(self,dt): > #draw screen > self.draw() > > > def draw(self): > self.clear() > self.fps_display.draw() > > > def on_key_press(self,symbol,modifiers): > if symbol == key.ESCAPE: > self.close() > #fullscreen toggle > if symbol == key.ENTER: > if modifiers & key.MOD_ALT: > #if fullscreen off, turn on and scale the screen > if self.fullscreen == False: > window.set_fullscreen(True) > glScalef(window.width/640.0,window.height/480.0, > 1.0)#2.25x, 1.875y > self.aspect[0] = window.width/640.0 > self.aspect[1] = window.height/480.0 > print 'PONG',self.aspect > #if its on, turn it off and un-scale the screen > else: > window.set_fullscreen(False) > glScalef((window.width/640.0)/self.aspect[0],( > window.height/480.0)/self.aspect[1],1.0) > > #tab out of fullsceen > if symbol == key.TAB: > if modifiers & key.MOD_ALT: > if self.fullscreen == True: > window.set_fullscreen(False) > glScalef((window.width/640.0)/self.aspect[0],( > window.height/480.0)/self.aspect[1],1.0) > self.minimize() > > > if __name__ == '__main__': > window = example() > pyglet.app.run() >>
Re: Traditional full screen support with Alt+Tab?
Ah, sorry, for some reason I read your post as "Alt+Enter". >From a quick look at the docs, it shows that the Window.set_exclusive_keyboard() mode will do what you want. http://pyglet.readthedocs.io/en/pyglet-1.2-maintenance/programming_guide/keyboard.html?highlight=set_exclusive_keyboard#keyboard-exclusivity On Thursday, January 12, 2017 at 7:36:37 AM UTC+9, Charles wrote: > > Hey Benjamin, ALT + ENTER does work, just ALT + TAB doesn't. I'm thinking > Windows switches out of the window pyglet gets a chance to see the > keypresses. > > On Monday, January 9, 2017 at 1:11:07 AM UTC-6, Benjamin Moran wrote: >> >> Pyglet doesn't capture any keypresses by default, but I usually just add >> the additional events like so: >> @window.event >> def on_key_press(key, mod): >> if key == pyglet.window.key.ENTER and mod == pyglet.window.key. >> MOD_ALT: >> .. >> .. >> >> if window.fullscreen is True: >> window.set_fullscreen(fullscreen=False) >> else: >> window.set_fullscreen(fullscreen=True) >> >> >> >> >> >> On Monday, January 9, 2017 at 8:18:53 AM UTC+9, Charles wrote: >>> >>> It's been a while since I have been able to program again, however I >>> just tried this and the alt tab combination is not actually registered by >>> pyglet (Windows 7). >>> >>> On Saturday, December 3, 2016 at 4:46:37 PM UTC-6, magu...@gmail.com >>> wrote: What you can do is capture the alt-tab keys and use window.set_fullscreen(False) to return to the desktops native resolution, then you could use window.minimize() to miminize it to the task bar or just leave it around. I've tried a few other approaches using window.on_activate() and window.on_deactivate() for when the window gains and looses focus, though I found the results were a little janky when it came to scaling properly, others may be able to get better results. As it stands in my current example when you tab back the window won't be in fullscreen mode, but a simple alt+enter solves that. Example: import pyglet from pyglet.window import key from pyglet.gl import * class example(pyglet.window.Window): def __init__(self): super(example, self).__init__(640, 480, resizable=False, fullscreen=True, caption="Test") self.clear() #fullscreen aspect ratio self.aspect = [self.width/640.0,self.height/480.0] pyglet.clock.get_fps() self.fps_display = pyglet.clock.ClockDisplay() pyglet.clock.schedule_interval(self.update, .01) def update(self,dt): #draw screen self.draw() def draw(self): self.clear() self.fps_display.draw() def on_key_press(self,symbol,modifiers): if symbol == key.ESCAPE: self.close() #fullscreen toggle if symbol == key.ENTER: if modifiers & key.MOD_ALT: #if fullscreen off, turn on and scale the screen if self.fullscreen == False: window.set_fullscreen(True) glScalef(window.width/640.0,window.height/480.0,1.0 )#2.25x, 1.875y self.aspect[0] = window.width/640.0 self.aspect[1] = window.height/480.0 print 'PONG',self.aspect #if its on, turn it off and un-scale the screen else: window.set_fullscreen(False) glScalef((window.width/640.0)/self.aspect[0],( window.height/480.0)/self.aspect[1],1.0) #tab out of fullsceen if symbol == key.TAB: if modifiers & key.MOD_ALT: if self.fullscreen == True: window.set_fullscreen(False) glScalef((window.width/640.0)/self.aspect[0],( window.height/480.0)/self.aspect[1],1.0) self.minimize() if __name__ == '__main__': window = example() pyglet.app.run() -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
Re: Traditional full screen support with Alt+Tab?
Hey Benjamin, ALT + ENTER does work, just ALT + TAB doesn't. I'm thinking Windows switches out of the window pyglet gets a chance to see the keypresses. On Monday, January 9, 2017 at 1:11:07 AM UTC-6, Benjamin Moran wrote: > > Pyglet doesn't capture any keypresses by default, but I usually just add > the additional events like so: > @window.event > def on_key_press(key, mod): > if key == pyglet.window.key.ENTER and mod == pyglet.window.key.MOD_ALT > : > .. > .. > > if window.fullscreen is True: > window.set_fullscreen(fullscreen=False) > else: > window.set_fullscreen(fullscreen=True) > > > > > > On Monday, January 9, 2017 at 8:18:53 AM UTC+9, Charles wrote: >> >> It's been a while since I have been able to program again, however I just >> tried this and the alt tab combination is not actually registered by pyglet >> (Windows 7). >> >> On Saturday, December 3, 2016 at 4:46:37 PM UTC-6, magu...@gmail.com >> wrote: >>> >>> What you can do is capture the alt-tab keys and use >>> window.set_fullscreen(False) to return to the desktops native resolution, >>> then you could use window.minimize() to miminize it to the task bar or just >>> leave it around. I've tried a few other approaches using >>> window.on_activate() and window.on_deactivate() for when the window gains >>> and looses focus, though I found the results were a little janky when it >>> came to scaling properly, others may be able to get better results. As it >>> stands in my current example when you tab back the window won't be in >>> fullscreen mode, but a simple alt+enter solves that. Example: >>> >>> import pyglet >>> from pyglet.window import key >>> from pyglet.gl import * >>> >>> class example(pyglet.window.Window): >>> def __init__(self): >>> super(example, self).__init__(640, 480, resizable=False, >>> fullscreen=True, caption="Test") >>> self.clear() >>> >>> #fullscreen aspect ratio >>> self.aspect = [self.width/640.0,self.height/480.0] >>> >>> pyglet.clock.get_fps() >>> self.fps_display = pyglet.clock.ClockDisplay() >>> >>> pyglet.clock.schedule_interval(self.update, .01) >>> >>> >>> def update(self,dt): >>> #draw screen >>> self.draw() >>> >>> >>> def draw(self): >>> self.clear() >>> self.fps_display.draw() >>> >>> >>> def on_key_press(self,symbol,modifiers): >>> if symbol == key.ESCAPE: >>> self.close() >>> #fullscreen toggle >>> if symbol == key.ENTER: >>> if modifiers & key.MOD_ALT: >>> #if fullscreen off, turn on and scale the screen >>> if self.fullscreen == False: >>> window.set_fullscreen(True) >>> >>> glScalef(window.width/640.0,window.height/480.0,1.0)#2.25x, >>> 1.875y >>> self.aspect[0] = window.width/640.0 >>> self.aspect[1] = window.height/480.0 >>> print 'PONG',self.aspect >>> #if its on, turn it off and un-scale the screen >>> else: >>> window.set_fullscreen(False) >>> glScalef((window.width/640.0)/self.aspect[0],(window >>> .height/480.0)/self.aspect[1],1.0) >>> >>> #tab out of fullsceen >>> if symbol == key.TAB: >>> if modifiers & key.MOD_ALT: >>> if self.fullscreen == True: >>> window.set_fullscreen(False) >>> glScalef((window.width/640.0)/self.aspect[0],(window >>> .height/480.0)/self.aspect[1],1.0) >>> self.minimize() >>> >>> >>> if __name__ == '__main__': >>> window = example() >>> pyglet.app.run() >>> >>> >>> >>> -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
Re: Traditional full screen support with Alt+Tab?
Pyglet doesn't capture any keypresses by default, but I usually just add the additional events like so: @window.event def on_key_press(key, mod): if key == pyglet.window.key.ENTER and mod == pyglet.window.key.MOD_ALT: .. .. if window.fullscreen is True: window.set_fullscreen(fullscreen=False) else: window.set_fullscreen(fullscreen=True) On Monday, January 9, 2017 at 8:18:53 AM UTC+9, Charles wrote: > > It's been a while since I have been able to program again, however I just > tried this and the alt tab combination is not actually registered by pyglet > (Windows 7). > > On Saturday, December 3, 2016 at 4:46:37 PM UTC-6, magu...@gmail.com > wrote: >> >> What you can do is capture the alt-tab keys and use >> window.set_fullscreen(False) to return to the desktops native resolution, >> then you could use window.minimize() to miminize it to the task bar or just >> leave it around. I've tried a few other approaches using >> window.on_activate() and window.on_deactivate() for when the window gains >> and looses focus, though I found the results were a little janky when it >> came to scaling properly, others may be able to get better results. As it >> stands in my current example when you tab back the window won't be in >> fullscreen mode, but a simple alt+enter solves that. Example: >> >> import pyglet >> from pyglet.window import key >> from pyglet.gl import * >> >> class example(pyglet.window.Window): >> def __init__(self): >> super(example, self).__init__(640, 480, resizable=False, >> fullscreen=True, caption="Test") >> self.clear() >> >> #fullscreen aspect ratio >> self.aspect = [self.width/640.0,self.height/480.0] >> >> pyglet.clock.get_fps() >> self.fps_display = pyglet.clock.ClockDisplay() >> >> pyglet.clock.schedule_interval(self.update, .01) >> >> >> def update(self,dt): >> #draw screen >> self.draw() >> >> >> def draw(self): >> self.clear() >> self.fps_display.draw() >> >> >> def on_key_press(self,symbol,modifiers): >> if symbol == key.ESCAPE: >> self.close() >> #fullscreen toggle >> if symbol == key.ENTER: >> if modifiers & key.MOD_ALT: >> #if fullscreen off, turn on and scale the screen >> if self.fullscreen == False: >> window.set_fullscreen(True) >> >> glScalef(window.width/640.0,window.height/480.0,1.0)#2.25x, >> 1.875y >> self.aspect[0] = window.width/640.0 >> self.aspect[1] = window.height/480.0 >> print 'PONG',self.aspect >> #if its on, turn it off and un-scale the screen >> else: >> window.set_fullscreen(False) >> glScalef((window.width/640.0)/self.aspect[0],(window. >> height/480.0)/self.aspect[1],1.0) >> >> #tab out of fullsceen >> if symbol == key.TAB: >> if modifiers & key.MOD_ALT: >> if self.fullscreen == True: >> window.set_fullscreen(False) >> glScalef((window.width/640.0)/self.aspect[0],(window. >> height/480.0)/self.aspect[1],1.0) >> self.minimize() >> >> >> if __name__ == '__main__': >> window = example() >> pyglet.app.run() >> >> >> >> -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
Re: Traditional full screen support with Alt+Tab?
It's been a while since I have been able to program again, however I just tried this and the alt tab combination is not actually registered by pyglet (Windows 7). On Saturday, December 3, 2016 at 4:46:37 PM UTC-6, magu...@gmail.com wrote: > > What you can do is capture the alt-tab keys and use > window.set_fullscreen(False) to return to the desktops native resolution, > then you could use window.minimize() to miminize it to the task bar or just > leave it around. I've tried a few other approaches using > window.on_activate() and window.on_deactivate() for when the window gains > and looses focus, though I found the results were a little janky when it > came to scaling properly, others may be able to get better results. As it > stands in my current example when you tab back the window won't be in > fullscreen mode, but a simple alt+enter solves that. Example: > > import pyglet > from pyglet.window import key > from pyglet.gl import * > > class example(pyglet.window.Window): > def __init__(self): > super(example, self).__init__(640, 480, resizable=False, > fullscreen=True, caption="Test") > self.clear() > > #fullscreen aspect ratio > self.aspect = [self.width/640.0,self.height/480.0] > > pyglet.clock.get_fps() > self.fps_display = pyglet.clock.ClockDisplay() > > pyglet.clock.schedule_interval(self.update, .01) > > > def update(self,dt): > #draw screen > self.draw() > > > def draw(self): > self.clear() > self.fps_display.draw() > > > def on_key_press(self,symbol,modifiers): > if symbol == key.ESCAPE: > self.close() > #fullscreen toggle > if symbol == key.ENTER: > if modifiers & key.MOD_ALT: > #if fullscreen off, turn on and scale the screen > if self.fullscreen == False: > window.set_fullscreen(True) > > glScalef(window.width/640.0,window.height/480.0,1.0)#2.25x, > 1.875y > self.aspect[0] = window.width/640.0 > self.aspect[1] = window.height/480.0 > print 'PONG',self.aspect > #if its on, turn it off and un-scale the screen > else: > window.set_fullscreen(False) > glScalef((window.width/640.0)/self.aspect[0],(window. > height/480.0)/self.aspect[1],1.0) > > #tab out of fullsceen > if symbol == key.TAB: > if modifiers & key.MOD_ALT: > if self.fullscreen == True: > window.set_fullscreen(False) > glScalef((window.width/640.0)/self.aspect[0],(window. > height/480.0)/self.aspect[1],1.0) > self.minimize() > > > if __name__ == '__main__': > window = example() > pyglet.app.run() > > > > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
Re: Traditional full screen support with Alt+Tab?
What you can do is capture the alt-tab keys and use window.set_fullscreen(False) to return to the desktops native resolution, then you could use window.minimize() to miminize it to the task bar or just leave it around. I've tried a few other approaches using window.on_activate() and window.on_deactivate() for when the window gains and looses focus, though I found the results were a little janky when it came to scaling properly, others may be able to get better results. As it stands in my current example when you tab back the window won't be in fullscreen mode, but a simple alt+enter solves that. Example: import pyglet from pyglet.window import key from pyglet.gl import * class example(pyglet.window.Window): def __init__(self): super(example, self).__init__(640, 480, resizable=False, fullscreen= True, caption="Test") self.clear() #fullscreen aspect ratio self.aspect = [self.width/640.0,self.height/480.0] pyglet.clock.get_fps() self.fps_display = pyglet.clock.ClockDisplay() pyglet.clock.schedule_interval(self.update, .01) def update(self,dt): #draw screen self.draw() def draw(self): self.clear() self.fps_display.draw() def on_key_press(self,symbol,modifiers): if symbol == key.ESCAPE: self.close() #fullscreen toggle if symbol == key.ENTER: if modifiers & key.MOD_ALT: #if fullscreen off, turn on and scale the screen if self.fullscreen == False: window.set_fullscreen(True) glScalef(window.width/640.0,window.height/480.0,1.0)#2.25x, 1.875y self.aspect[0] = window.width/640.0 self.aspect[1] = window.height/480.0 print 'PONG',self.aspect #if its on, turn it off and un-scale the screen else: window.set_fullscreen(False) glScalef((window.width/640.0)/self.aspect[0],(window. height/480.0)/self.aspect[1],1.0) #tab out of fullsceen if symbol == key.TAB: if modifiers & key.MOD_ALT: if self.fullscreen == True: window.set_fullscreen(False) glScalef((window.width/640.0)/self.aspect[0],(window. height/480.0)/self.aspect[1],1.0) self.minimize() if __name__ == '__main__': window = example() pyglet.app.run() -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.
Traditional full screen support with Alt+Tab?
In a lot of games the full screen support seems to be a little different than what pyglet offers. In full screen mode in pyglet, if you try to alt tab (especially if your game mode is different than your desktop mode) it doesn't return you to the desktop mode, it simply remains in the current mode and shows the application in the background with the taskbar. In other games if you are full screen, alt tab will switch you back to the desktop mode and allow you to essentially minimize the game while in full screen. Then you can select it at the bottom and it will push it back into the game mode and full screen again. Is there anyway I can achieve that with Pyglet? Thanks. -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to pyglet-users+unsubscr...@googlegroups.com. To post to this group, send email to pyglet-users@googlegroups.com. Visit this group at https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.