ipywidgets icon indicating copy to clipboard operation
ipywidgets copied to clipboard

Feature suggestion: full-screen mode for widgets

Open anentropic opened this issue 6 years ago • 11 comments

As suggested here: https://github.com/jupyter-widgets/ipywidgets/issues/1063#issuecomment-422946416

In the web browser environment it's possible to expand particular content to "full screen" mode https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API

An example would be YouTube video player.

I'm thinking for complicated plots etc it can be nice to 'go fullscreen'.

This could also be useful for code cells which generate a whole UI, you might want to tweak some settings from the regular notebook view, then 'launch' it and interact with the result.

anentropic avatar Sep 20 '18 21:09 anentropic

Something similar to what is presented in this talk? (in terms of behavior)

https://youtu.be/1XTMkcrVyQg?t=4m38s

image

jtpio avatar Sep 21 '18 19:09 jtpio

yes, exactly that!

anentropic avatar Sep 21 '18 20:09 anentropic

This is a fantastic idea and I found myself wishing it already existed today. If I knew more I'd try to help with it.

Ricyteach avatar May 14 '19 18:05 Ricyteach

We can hack. Here is an example of fullscreen mode in nglview.

Screen Shot 2019-06-16 at 2 07 51 AM

code

import nglview as nv
from ipywidgets import *

v = nv.demo()
b = v.player._display()
b.layout.width = '400px'
b.layout.align_self = 'flex-start'
bb = HBox([v, b])
_ = bb.add_class('nglview-f')

def on_display(self):
    v._execute_js_code("""

    var ele = document.getElementsByClassName("nglview-f")[0];
    console.log(ele);

    this.stage.viewer.container.style.height = window.screen.height + 'px'
    console.log(window.innerHeight)
    this.stage.toggleFullscreen(ele);
    
    """)
    
bb.on_displayed(on_display)
bb

... but official support would be super awesome.

hainm avatar Jun 16 '19 06:06 hainm

hi all, just for fun: I've made a super tiny package fullscreen to make an ipywidgets's widget fullscreen (while waiting for something similar in ipywidgets)

git: https://github.com/hainm/fullscreen

notebook: https://nbviewer.jupyter.org/github/hainm/fullscreen/blob/v0.0.1/notebooks/many_packages.ipynb

gif: fullscreen_small

hainm avatar Aug 01 '19 03:08 hainm

@hainm Do you think we could easily push this in ipywidgets core?

This feature would be super nice in most custom interactive widgets libraries (ipywebrtc, ipyleaflet, nglview, itkwidgets, ipyvolume .....)

Or maybe this could more generally be a Jupyter Notebook/JupyterLab feature (a small button next to the cell output just like in the video @jtpio posted)

martinRenou avatar Jan 07 '20 14:01 martinRenou

Or maybe this could more generally be a Jupyter Notebook/JupyterLab feature (a small button next to the cell output just like in the video @jtpio posted)

A JLab extension that would add a fullscreen button to an output cell would be interesting to see as a third-party extension. This would also have the benefit to work with output cells in general, not just widgets.

jtpio avatar Jan 07 '20 15:01 jtpio

hi @martinRenou I think it would be great in both cases (a button and an API). I suggest to add an API for fullscreen too because many widgets do not automatically resize in fullscreen mode, so we need to pass a "signal" to them.

hainm avatar Jan 07 '20 15:01 hainm

We already have phosphor resize signals being sent to widgets when they should resize themselves. Are phosphor resize signals sent when things are fullscreened? If not, we may need to manually send them.

jasongrout avatar Jan 07 '20 15:01 jasongrout

Was anyone able to figure out how the functionality seen in the link to the video shared by @jtpio can be achieved?

aayushsahni avatar Jul 19 '20 09:07 aayushsahni

Hi there, has there been any feature added in ipywidgets in order to achieve the full screen mode? My aim would be to open an Output widget instance a new browser window and set it to full screen mode.

mtbli avatar Dec 21 '21 08:12 mtbli