from tkinter import Tk, Label, Frame

from rx import from_
from rx import operators as _
from rx.subjects import Subject
from rx.concurrency import TkinterScheduler


def main():
    root = Tk()
    root.title("Rx for Python rocks")
    scheduler = TkinterScheduler(root)

    mousemove = Subject()

    frame = Frame(root, width=600, height=600)

    frame.bind("<Motion>", mousemove.on_next)

    text = 'TIME FLIES LIKE AN ARROW'

    def on_next(info):
        label, ev, i = info
        label.place(x=ev.x + i*12 + 15, y=ev.y)

    def handle_label(label, i):
        label.config(dict(borderwidth=0, padx=0, pady=0))

        mapper = _.map(lambda ev: (label, ev, i))
        delayer = _.delay(i*100)

        return mousemove.pipe(
            delayer,
            mapper
        )

    labeler = _.flat_mapi(handle_label)
    mapper = _.map(lambda c: Label(frame, text=c))

    from_(text).pipe(
        mapper,
        labeler
    ).subscribe_(on_next, on_error=print, scheduler=scheduler)

    frame.pack()
    root.mainloop()


if __name__ == '__main__':
    main()

from tkinter import Tk, Label, Frame

import rx
from rx import operators as ops
from rx.subjects import Subject
from rx.concurrency import TkinterScheduler


def main():
    root = Tk()
    root.title("Rx for Python rocks")
    scheduler = TkinterScheduler(root)

    mousemove = Subject()

    frame = Frame(root, width=600, height=600)

    frame.bind("<Motion>", mousemove.on_next)

    text = 'TIME FLIES LIKE AN ARROW'

    def on_next(info):
        label, ev, i = info
        label.place(x=ev.x + i*12 + 15, y=ev.y)

    def handle_label(label, i):
        label.config(dict(borderwidth=0, padx=0, pady=0))

        mapper = ops.map(lambda ev: (label, ev, i))
        delayer = ops.delay(i*100)

        return mousemove.pipe(
            delayer,
            mapper
        )

    labeler = ops.flat_mapi(handle_label)
    mapper = ops.map(lambda c: Label(frame, text=c))

    rx.from_(text).pipe(
        mapper,
        labeler
    ).subscribe_(on_next, on_error=print, scheduler=scheduler)

    frame.pack()
    root.mainloop()


if __name__ == '__main__':
    main()

Use ops instead of _
Use ops instead of _

  from tkinter import Tk, Label, Frame
  
- from rx import from_
+ import rx
- from rx import operators as _
+ from rx import operators as ops
  from rx.subjects import Subject
  from rx.concurrency import TkinterScheduler
  
  
  def main():
      root = Tk()
      root.title("Rx for Python rocks")
      scheduler = TkinterScheduler(root)
  
      mousemove = Subject()
  
      frame = Frame(root, width=600, height=600)
  
      frame.bind("<Motion>", mousemove.on_next)
  
      text = 'TIME FLIES LIKE AN ARROW'
  
      def on_next(info):
          label, ev, i = info
          label.place(x=ev.x + i*12 + 15, y=ev.y)
  
      def handle_label(label, i):
          label.config(dict(borderwidth=0, padx=0, pady=0))
  
-         mapper = _.map(lambda ev: (label, ev, i))
+         mapper = ops.map(lambda ev: (label, ev, i))
-         delayer = _.delay(i*100)
+         delayer = ops.delay(i*100)
  
          return mousemove.pipe(
              delayer,
              mapper
          )
  
-     labeler = _.flat_mapi(handle_label)
+     labeler = ops.flat_mapi(handle_label)
-     mapper = _.map(lambda c: Label(frame, text=c))
+     mapper = ops.map(lambda c: Label(frame, text=c))
  
-     from_(text).pipe(
+     rx.from_(text).pipe(
          mapper,
          labeler
      ).subscribe_(on_next, on_error=print, scheduler=scheduler)
  
      frame.pack()
      root.mainloop()
  
  
  if __name__ == '__main__':
      main()
  
Use ops instead of _
## Code Before:
from tkinter import Tk, Label, Frame

from rx import from_
from rx import operators as _
from rx.subjects import Subject
from rx.concurrency import TkinterScheduler


def main():
    root = Tk()
    root.title("Rx for Python rocks")
    scheduler = TkinterScheduler(root)

    mousemove = Subject()

    frame = Frame(root, width=600, height=600)

    frame.bind("<Motion>", mousemove.on_next)

    text = 'TIME FLIES LIKE AN ARROW'

    def on_next(info):
        label, ev, i = info
        label.place(x=ev.x + i*12 + 15, y=ev.y)

    def handle_label(label, i):
        label.config(dict(borderwidth=0, padx=0, pady=0))

        mapper = _.map(lambda ev: (label, ev, i))
        delayer = _.delay(i*100)

        return mousemove.pipe(
            delayer,
            mapper
        )

    labeler = _.flat_mapi(handle_label)
    mapper = _.map(lambda c: Label(frame, text=c))

    from_(text).pipe(
        mapper,
        labeler
    ).subscribe_(on_next, on_error=print, scheduler=scheduler)

    frame.pack()
    root.mainloop()


if __name__ == '__main__':
    main()

## Instruction:
Use ops instead of _
## Code After:
from tkinter import Tk, Label, Frame

import rx
from rx import operators as ops
from rx.subjects import Subject
from rx.concurrency import TkinterScheduler


def main():
    root = Tk()
    root.title("Rx for Python rocks")
    scheduler = TkinterScheduler(root)

    mousemove = Subject()

    frame = Frame(root, width=600, height=600)

    frame.bind("<Motion>", mousemove.on_next)

    text = 'TIME FLIES LIKE AN ARROW'

    def on_next(info):
        label, ev, i = info
        label.place(x=ev.x + i*12 + 15, y=ev.y)

    def handle_label(label, i):
        label.config(dict(borderwidth=0, padx=0, pady=0))

        mapper = ops.map(lambda ev: (label, ev, i))
        delayer = ops.delay(i*100)

        return mousemove.pipe(
            delayer,
            mapper
        )

    labeler = ops.flat_mapi(handle_label)
    mapper = ops.map(lambda c: Label(frame, text=c))

    rx.from_(text).pipe(
        mapper,
        labeler
    ).subscribe_(on_next, on_error=print, scheduler=scheduler)

    frame.pack()
    root.mainloop()


if __name__ == '__main__':
    main()
