Communicating between the forms

Need Help!!!. Have attached screenshot for the reference

I am trying to build interactive dashboard. I have 2 forms, one is MainForm and inside that form I have Form1, Please check the screenshots for reference.
image

Now on my MainForm I have few charts Like a simple bar chart, Now What I am trying to do is when I click on any one of those bars on my bar chart, I need user should get redirected to Form1 (which can be done by open_form(‘Form1’)) but and I want that bar details need to be showed on Form1 (label).
eg: In the below screenshots there are total 5 bars. first bar values is 5. I want that detail to be shown on the label which is present on the Form1.

Can anyone help me how this can be achieved.

image

image

This is the “Show & Tell” channel so I will move to “Q and A”.

I would suggest that you read some of the posts involving plotly click events.

For example, this post may help.

Hey @campopianoa Thanks for the response. Yes I have some knowledge about the plotly click event. I am getting that click value on the MainForm. But in this case I have a label on the Form1 and I want that value to be printed on From1 label.

I have attached the screenshot for the same. I have a variable called “var” which contain the value 5 on Mainform. When i write open_form(‘MainForm.Form1’,self.label_ …) I can access the label which is present on MainForm not on Form1. How can I achieve this.

Take a look here :

which gives some info on how open_form() works. The clue here is that a form’s constructor (__init__) takes kwargs (named “**properties”) which you can pass in your open_form() call.

The newly opened form can read these and act accordingly.

1 Like

Output from print goes to Anvil’s application logs, not into components. However, every Label has a text attribute that you can set.

1 Like