Replies: 2 comments
-
lump.starting() while True: and >>> This is right |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hello @alpxe, your example above translates to: def enterA():
enterB()
def enterB():
enterC()
def enterC():
enterA() while the code in your second example does this:
The from transitions import Machine, State
class Foo:
def helloAAA(self):
print(f"hello {self.state}")
self.toB()
def helloBBB(self):
print(f"hello {self.state}")
self.toC()
def helloCCC(self):
print(f"hello {self.state}")
self.toA()
def __init__(self):
states = [
State(name='S', on_enter='say_hello'),
State(name='A', on_enter='helloAAA'),
State(name='B', on_enter='helloBBB'),
State(name='C', on_enter='helloCCC'),
]
self.machine = Machine(model=self, states=states, initial="S", queued=True) # <--- queued=True
self.machine.add_transition(trigger='starting', source='S', dest='A')
self.machine.add_transition(trigger='toB', source='A', dest='B')
self.machine.add_transition(trigger='toC', source='B', dest='C')
self.machine.add_transition(trigger='toA', source='C', dest='A')
f = Foo()
f.starting() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
from transitions import State, Machine
class Matter:
lump = Matter()
lump.starting()
Unable to loop???
The requirement are step by step , then exit
but it is wrong!!!!!
Beta Was this translation helpful? Give feedback.
All reactions