'Why does print run only after executing while loop is done in Jython and not during the execution of the while loop

I already tried using sys.stdout.write(output) sys.stdout.flush(), The Script is running in Jython using JMX, in Python its ok

Just print after the program is done and not when the infinite while is executing

while True:
  for enlace in enlaces:
    try:
     print( monitor.status("proc", "stat" + enlace))
     print("----------------------------------------------------")
    except Error, e:
      print ("Script Failed, " + e.value )

  time.sleep(1)


Solution 1:[1]

Consider using AnimatedPositioned inside a Stack. You can the play with the values of their position (top, bottom, left, right) and sizes (height, width).

Here is a video the flutter team made: https://www.youtube.com/watch?v=hC3s2YdtWt8

Consider this as just one way to do it, there are many ways.

Solution 2:[2]

A simple of doing this using AnimatedContainer and changing active container with Timer.

Run on dartPad

class AnimC3 extends StatefulWidget {
  const AnimC3({Key? key}) : super(key: key);

  @override
  _AnimC3State createState() => _AnimC3State();
}

class _AnimC3State extends State<AnimC3> {
  final duration = const Duration(seconds: 1);

  int _currentIndex = 0;

  late Timer _timer;

  @override
  void initState() {
    _timer = Timer.periodic(duration, (timer) {
      setState(() {
        _currentIndex++;
        if (_currentIndex > 2) _currentIndex = 0;
      });
    });
    super.initState();
  }

  @override
  void dispose() {
    _timer.cancel();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: SizedBox(
          width: 200,
          child: Row(
            children: [
              AnimatedContainer(
                duration: duration,
                width: _currentIndex == 0 ? 100 : 50,
                color: Colors.purpleAccent,
              ),
              AnimatedContainer(
                duration: duration,
                color: Colors.cyanAccent,
                width: _currentIndex == 1 ? 100 : 50,
              ),
              AnimatedContainer(
                duration: duration,
                color: Colors.red,
                width: _currentIndex == 2 ? 100 : 50,
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Juan Carlos Ramón Condezo
Solution 2 Yeasin Sheikh