#!/usr/bin/env python # coding: utf-8 # In[ ]: import ipyvuetify as v import traitlets from traitlets import Int, Unicode, List, Dict, Bool # # URL text box # # https://vuetifyjs.com/en/components/text-fields # In[ ]: v.Col(cols=6, children=[ v.TextField(outlined=True, class_='ma-2', label='URL', placeholder='https://') ]) # In[ ]: # home listing # https://www.rightmove.co.uk/property-for-sale/property-72921928.html # all listing data: property of Rightmove.co.uk # In[ ]: from download_listing import get_listing from pprint import pprint class URLTextField(v.VuetifyTemplate): url = Unicode('').tag(sync=True, allow_null=True) loading = Bool(False).tag(sync=True) template = Unicode(''' ''').tag(sync=True) def vue_get_properties(self, data): self.loading = True pprint(get_listing(data)) self.loading = False URLTextField() # # Card # https://vuetifyjs.com/en/components/cards # In[ ]: from download_listing import get_listing class URLTextField(v.VuetifyTemplate): url = Unicode('').tag(sync=True, allow_null=True) loading = Bool(False).tag(sync=True) props = List(get_listing('')).tag(sync=True) show = Bool(False).tag(sync=True) price_string = Unicode('£1,000,000').tag(sync=True) template = Unicode(''' ''').tag(sync=True) def vue_get_properties(self, data): self.disabled = True self.loading = True self.props = list(get_listing(data)) self.price_string = f'£{self.props[0]:,.0f}' self.disabled = False self.loading = False u = URLTextField() u # # Sparkline # https://vuetifyjs.com/en/components/sparklines # In[ ]: get_ipython().run_line_magic('matplotlib', 'inline') # In[ ]: import numpy as np import pandas as pd strange_walk = np.random.beta(2, 3, 10) * 100 * np.random.normal(size=10) strange_walk = pd.Series(strange_walk, name='Strange Walk').cumsum().round(2) strange_walk.plot() # In[ ]: class SeriesSparkline(v.VuetifyTemplate): name = Unicode('').tag(sync=True) value = List([1,2,3]).tag(sync=True) template = Unicode(""" """).tag(sync=True) def __init__(self, *args, data=pd.Series(), **kwargs): super().__init__(*args, **kwargs) self.name = data.name self.value = data.tolist() s = SeriesSparkline(data=strange_walk) s # In[ ]: