Forum Archive

Changing button position around in Navigation View

RocketBlaster05

I’m sure this is a simple problem but I can’t seem to get the button to move within the bounds of my navigation view. Here is the code I have. Where should I put the buttons position?

#there is always the possibility I was just entering the wrong position values but nonetheless any help would be appreciated.
def start_NavView(self):
        self.view = ui.View()
        self.view.background_color='white'
        self.view.name='View1'
        nav = ui.NavigationView(self.view)
        nav.present()
        def view2_activate(sender):
            view2 = ui.View()
            view2.name='View2'
            view2.background_color='blue'
            nav.push_view(view2)
        b1 = ui.Button(
            title='Test',
            tint_color='white',
            background_color='blue',
            action=view2_activate
        )
        frm = b1.frame
        bnds = self.view.bounds
        #tried it here 
        b1.frame = frm.inset(-8,-8)
        b1.frame = (
            bnds.width - b1.width - 8,
            bnds.height - b1.height - 8,
            b1.width,
            b1.height
        )
        #tried it here
        b1.flex = 'WH'
        #tried it here
        self.view.add_subview(b1) 
RocketBlaster05

Nevermind I realized that I can just use ui.load_view() in order to bring up a custom made popup on the navigation menu.