Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can i make button upper than the component it controls. #8329

Closed
zhangbo2008 opened this issue May 19, 2024 · 3 comments
Closed

how can i make button upper than the component it controls. #8329

zhangbo2008 opened this issue May 19, 2024 · 3 comments

Comments

@zhangbo2008
Copy link

with gr.Blocks(head=head,theme=seafoam) as demo:
    # gr.Markdown("下面是全部的可以查询的列名")
    showlieming = gr.Button("所有字段",size="sm")
    showlieming.click(showliemingf, [showlieming_state],[showlieming_state,lieming])

    # with gr.Blocks():
    lieming=gr.DataFrame(headers=None,value=all_key2,visible=True,
                         interactive=False,
                         wrap=True,scale=1,type='pandas')

i wanna use button showlieming to control the visaible of the lieming dataframe. how to set it upper than the lieming component? Thansk a lot my friends.

@yvrjsharma
Copy link
Collaborator

Hi @zhangbo2008 are you looking for something like below?

with gr.Blocks(theme=gr.themes.Soft()) as demo:

    showlieming = gr.Button("Set Visible",size="sm")
    hidelieming = gr.Button("Set Invisible",size="sm", visible=False)

    lieming=gr.DataFrame(headers=None,value=[[1,2,3]],visible=False,
                         interactive=False,
                         wrap=True,scale=1,type='pandas')
    showlieming.click(lambda :(gr.DataFrame(visible=True), gr.Button(visible=False), gr.Button(visible=True)), [],[lieming, showlieming, hidelieming])
    hidelieming.click(lambda :(gr.DataFrame(visible=False), gr.Button(visible=True), gr.Button(visible=False)), [],[lieming, showlieming, hidelieming])

demo.launch()
gradio_github_issue8329.mp4

@abidlabs
Copy link
Member

Thanks @yvrjsharma and @zhangbo2008! By the way, for general questions like this (that are not feature requests or bug reports), please ask in our Discord server. (I'll close this issue)

@abidlabs abidlabs closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
@zhangbo2008
Copy link
Author

thanks a lot. very appreciate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants