How does the "width" property of Spacer component work?

What I’m trying to do:
Figure out how to set the width property of a Spacer component. No matter what value I give it, the space doesn’t change on screen

Code Sample:

class Startup(StartupTemplate):
  def __init__(self, **properties):
    anvil.users.login_with_form()    
    self.spacer_1.width = '10000000'
    self.init_components(**properties)
    json_tree = anvil.server.call('tree_example')

Clone link:
https://anvil.works/build#clone:7CH7XR6GAMNBMWP7=RXZ2I2BPSQQZJBOR45AQANTG

Hi @nathanguyette -

As Stefano explained in your previous thread, in Anvil the width of components is governed by the container, not the component itself. Therefore, if you want to widen the spacer, look to the container - either by changing the column widths in a ColumnPanel, or by using the width= layout property in a Flow Panel (or similar layout properties in Grid Panel etc).

1 Like