Created
January 11, 2022 09:17
-
-
Save joseberlines/8a5f0ba673d12034d69749cb831c2a88 to your computer and use it in GitHub Desktop.
open tabs from voila
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ipyvuetify as vue | |
from ipywidgets import Output | |
from IPython.display import Javascript | |
b1 = vue.Btn(class_='mx-2 light-blue darken-1', color='primary',children=['open lemonde']) | |
b2 = vue.Btn(class_='mx-2 light-blue darken-1', color='primary',children=['open nyt']) | |
b3 = vue.Btn(class_='mx-2 light-blue darken-1', color='primary',children=['open all']) | |
out=Output() | |
def open_lemonde(widget, event, data): | |
with out: | |
print('clicked') | |
display(Javascript(f'window.open("https://www.lemonde.fr");')) | |
print('le monde opened') | |
def open_nyt(widget, event, data): | |
with out: | |
print('clicked') | |
display(Javascript(f'window.open("https://www.nytimes.com");')) | |
print('nyt opened') | |
def open_all(widget, event, data): | |
b1.fire_event('click', None) | |
b2.fire_event('click', None) | |
b1.on_event('click', open_lemonde) | |
b2.on_event('click', open_nyt) | |
b3.on_event('click', open_all) | |
display(vue.Layout(children=[b1,b2,b3,out])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment