title: How to display constantly updating text on fullscreen while going through states in a state machine?
body: <p>I'm new to python and programming in general and I'm trying to build an algorithm using a state machine implementation by Pytransitions.</p>
  <p>I'm trying to find a way to display text on a small external LCD screen connected to an RPi 4 Model B while simultaneously having the program run through 3 states, each displaying a different message.</p>
  <p>Here is an example of what I tried, I'm pretty sure what's causing me trouble is win.mainloop(), but I have no idea how to fix it.
  From my understanding after reading the documentation, I must include it at the end of the code to spawn the window itself, but then the text update upon transition from state to state still don't work as I expected - they simply don't show up at all.</p>
  <p>Here is the code for a simplified 3 state system:</p>
  <pre><code>from transitions import Machine
  from tkinter import *
  import time
  
  win = Tk()
  intvar = StringVar() #A tkinter string variable for labels
  cntdwn = 10
  intvar.set = 10
  
  class Identification(object):
      def on_enter_A(self):
          print(&quot;We've just entered State A&quot;)
          update_window('System Started')
      def on_enter_B(self):
          print(&quot;We've just entered State B&quot;)
          update_window('Please look into the camera')
      def on_enter_C(self):
          print(&quot;We've just entered State C&quot;)
          update_window('Face and readings authorized')
  
  def update_window(msg):
      label.configure(text=msg)
  
  def rdy():
      #label= Label(win, text= &quot;Sensors fully calibrated, please blow on the sensor&quot;, font=('Times New Roman bold',50))
      label.pack(padx=10, pady=10)
      label.configure(text=&quot;Sensors fully calibrated, please blow on the sensor&quot;)
  
  def cntdwn_update(secs):
      if (secs):
          label.configure(text=&quot;Greetings,booting system &amp; calibrating sensors &quot; +str(secs))
          win.after(1000, cntdwn_update, secs-1)
  
  SBS = Identification()
  states = ['A', 'B', 'C'] #Set the states in which the machine operates
  transitions = [
      { 'trigger': 'System_Ready', 'source': 'A', 'dest': 'B' },
      { 'trigger': 'Picture_Taken', 'source': 'B', 'dest': 'C' },
      { 'trigger': 'User_Verified', 'source': 'C', 'dest': 'A' }
      ] #Sets the transition parameter string for each state
  machine = Machine(SBS, states=states, transitions = transitions, initial='A')
  
  win.geometry(&quot;650x250&quot;) #Set the geometry
  win.attributes('-fullscreen', True) #Create a fullscreen window
  intvar.set = &quot;Greetings, calibrating sensor (10s)&quot;
  label= Label(win, text= &quot;Greetings, calibrating sensors &quot; + str(cntdwn), font=('Times New Roman bold',50))
  label.pack(padx=10, pady=10)
  win.after(1000, cntdwn_update, cntdwn-1)
  win.after(10000, rdy)
  #win.after(12000, update_window, 'Please look into the camera')  #This works but I want this 
  to activate when the state switches, not after an a set amount of time.
  
  SBS.System_Ready()
  SBS.Picture_Taken()
  SBS.User_Verified()
  win.mainloop()
  </code></pre>
  <p>What happens is as follows:</p>
  <p>The screen displays &quot;System Started&quot; for 1 second, then it displays the &quot;Sensors calibrating&quot; message while self-updating every second for a total of 10 seconds, then it displays &quot;Sensors fully calibrated, please blow on the sensor.&quot;</p>
  <p>At no point does it print any of the strings attached to the state change event, i.e &quot;Please look into the camera&quot; or &quot;Face and readings authorized&quot;.</p>
  <p>How do I tackle this?</p>
  <p>Any help would be much appreciated!</p>