Can´t run tkinter in Atom

When I try to run a python script with tkinter it just says finished without opening any new window with canvas. I tried to run it with script and python-runner.

See if this works for you:

import tkinter
import random

window = tkinter.Tk() # initialize 
window.title("GRAPHICAL") # name the window
canvas = tkinter.Canvas(window, bg='white', width=300, height=300) # canvas in window

for i in range(1000): 
   x = random.randrange(300)
   y = random.randrange(300)
   if x < 150:
      color = 'red'
   else:
      color = 'blue'
   canvas.create_oval(x-5, y-5, x+5, y+5, fill=color, outline='')

canvas.pack() # canvas packed / positioned into the window
window.mainloop() # keep window open

Answer based on:
I can't execute Python code
https://www.tutorialspoint.com/python/tk_canvas.htm

Thank you very much. It works perfectly.