This returns False
import panel as pn
pn.extension()
tab1 = ("ABC", "abc")
tab2 = ("DEF", "def")
tabs = pn.Tabs(tab1, tab2)
tab1 in tabs
This returns False
import panel as pn
pn.extension()
tab1 = ("ABC", "abc")
tab2 = ("DEF", "def")
tabs = pn.Tabs(tab1, tab2)
tab1 in tabs
Hi @ahuang11
What behavior are you expecting?
You can inspect the tabs that the tabs
object is holding via
import panel as pn
pn.extension()
tab1 = ("ABC", "abc")
tab2 = ("DEF", "def")
tabs = pn.Tabs(tab1, tab2)
print(tabs)
print(tabs.objects)
$ python 'script.py'
Tabs
[0] Markdown(str, name='ABC')
[1] Markdown(str, name='DEF')
[Markdown(str, name='ABC'), Markdown(str, name='DEF')]
I want to check if tabs contains tab1
The you would have to change your code a bit @ahuang11 . For example to
pn.extension()
tab1 = pn.pane.Markdown("abc", name="ABC")
tab2 = pn.pane.Markdown("def", name="DEF")
tab3 = pn.pane.Markdown("ghi", name="GHI")
tabs = pn.Tabs(tab1, tab2)
print(tabs)
print(tab1 in tabs)
print(tab2 in tabs)
print(tab3 in tabs)
$ python 'script.py'
Tabs
[0] Markdown(str, name='ABC')
[1] Markdown(str, name='DEF')
True
True
False