Skip to content

Instantly share code, notes, and snippets.

@LinuxIsCool
Created November 30, 2022 22:31
Show Gist options
  • Select an option

  • Save LinuxIsCool/8d8e85f672aca23c3a0e0affda65ca67 to your computer and use it in GitHub Desktop.

Select an option

Save LinuxIsCool/8d8e85f672aca23c3a0e0affda65ca67 to your computer and use it in GitHub Desktop.
Minimum viable embedded app and dynamic display threshold example for python param panel
import param as pm
import panel as pn
pn.extension()
class Protocol(pm.Parameterized):
display_level = pm.Integer(default=1, bounds=(0, 2), step=1, precedence=2)
target_apy = pm.Number(0.15, bounds=(0,1), precedence=1)
total_curve_pool_tvl = pm.Number(1e7, bounds=(0,None), precedence=0)
def __init__(self):
super().__init__()
self.app = pn.Param(self.param)
self.update_display_level()
@pm.depends("display_level", watch=True)
def update_display_level(self):
self.app.display_threshold = 2 - self.display_level
p = Protocol()
p.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment