[Question] What is the use of the key field, can it replace ft.Ref
              
              #1645
            
            
          -
| Questiondef topLeftLayout(self):
    """letfColumn layout"""
    return ft.Column(
        controls=[
            ft.ElevatedButton(
                ref=func.get('ref', None),
                key=func.get("key", None),
                text=func.get("label", None),
                tooltip=func.get("tooltip", None),
                on_click=getattr(self, func.get('handle', 'on_default')),
            ) for func in Ref.funcDef
        ],
        ref=Ref.leftColumn,
        key='leftColumn',
    )I want to use it like this, but he reports an error self.page['leftColumn'].height = 200
# Or keys, variables like
self.page.keys['leftColumn'].height = 200It is cumbersome to declare a lot of Ref variables, especially for dynamically added controls Code sampleNo response Error messageException in thread Thread-34 (__sync_handler):
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/[email protected]/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/opt/homebrew/Cellar/[email protected]/3.10.12_1/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/homebrew/lib/python3.10/site-packages/flet_core/event_handler.py", line 30, in __sync_handler
    h(e)
  File "~/gui/event.py", line 90, in on_resize
    print(self.page['leftColumn'])
TypeError: 'Page' object is not subscriptable------------------------------------------------------
 | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            ndonkoHenri
          
      
      
        Jul 26, 2023 
      
    
    Replies: 1 comment
-
| 
 | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        Alan3344
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Keyis used only for scrolling purposes . More on it here.