@nerdtron , no problems. I think for this example that flex would be the best and easiest. However, when I tried doing it, I had a brain freeze! Its been a long time since I have done it. Pls dont take that as it is hard to do. Once you have it in your head, normally its simple.
I am sure someone else here will chime in with the correct way to set the flex settings.
The example I have put below is still a good a good way to know. Its using a custom view. One of the callbacks you get when you have a Custom View Class is layout. Its called by the ui automatically (if you have a method called layout) when you need to respond to changes in your views height or width. Its worth having a read through the docs about Custom Views.
They are easy to make and give you a lot more flexibility and some extra functionality.
Anyway, I hope this also helpsimport ui class MyClass(ui.View): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # create the field and button self.in_fld = ui.TextField() self.post_btn = ui.Button(title='Add Item', bg_color='orange', corner_radius=6, action=self.btn_action, ) # do some static adjustments to button and field properites # properties that we dont need to calculate in layout self.post_btn.size_to_fit() self.post_btn.width += 4 self.post_btn.y = 2 self.in_fld.x = 2 self.in_fld.y = 2 self.in_fld.height = self.post_btn.height self.add_subview(self.in_fld) self.add_subview(self.post_btn) def btn_action(self, sender): # just to show its working append '@' to the in_fld text self.in_fld.text += '@' def layout(self): ''' This method is called by the ui automatically when required, such as orientation change. ''' # only need to adjust the width of the fld and the x pos # of the btn for this case self.in_fld.width = self.width - self.post_btn.width - 6 self.post_btn.x = self.in_fld.frame.max_x + 2 if __name__ == '__main__': mc = MyClass() mc.present() ''' This would also work as expected if __name__ == '__main__': f=(0, 0, 320, 480) mc = MyClass(frame=f) mc.present('sheet') '''