My code has the screenmanager and the App class in another python file. I want to cahnge the window from "order_screen" to "order_review" with the press of a button. I can achieve this affect in my kv code (See the second code)
class SubmitAll(Screen):
Price = Price()
new_list = []
Order = Order_full()
ordered_products =[]
order = StringProperty(str(ordered_products))
ReviewLayout = ReviewLayout()
def __init__(self, **kwargs):
Screen.__init__(self, **kwargs)
b = Button(text="submit")
b.bind(on_press=lambda x: self.submit_all())
# b.bind(on_press=self.changer)
self.add_widget(b)
def submit_all(self):
pass
def changer(self,*args):
self.manager.current = 'order_review'
print('yes')
If I make the button in kv and use on_press: app.root.current it works flawlessly, however I cant achieve the same result in the python file.
<Order_Review@Screen>:
name: "order_review"
ReviewLayout:
<SubmitAll>:
name: "submission"
GridLayout:
cols:1
Button:
text: "Submit All"
on_press: root.submit_all()
on_release:
app.root.current = "order_review"
I tried using a changer method to make this happen, however I get the error
AttributeError: 'NoneType' object has no attribute 'current'
How can I replicate the same affect that I got in the kv code with app.root.current in my python code?(which is basiaclly switching screens with a button click)
------------edit Screen manager kv:
WindowManager:
one: one
MainWindow:
Order_Page:
id: one
SubmitAll:
Order_Review:
Screenmanager class:
class WindowManager(ScreenManager):
def switching_function(*args):
WindowManager.current = 'review'
The class is in another python file( the main one where eeverything else get imported)