Why do i have t use tkinter?


Name: Ang Li, Jash Rathod
Lab: Draw a Fibonacci Spiral
Date: Feb 22, 2018
Class: CS 111

This programe helps us draw the fibonacci spiral based on the input of number of layers from the user.
import turtle
def fib(n):
This function is to calculate the Fibonacci sequence.
n: is the numbers that will be in the Fibonacci sequence
Return values:
The return values will be b who is the number is the Fibonacci sequence
for i in range(2,n+1):
a = a + b
a,b = b,a
return b #Returns the fibonacci vaue
def ss(n): #Drawing the squares and spirals
This function is to draw a square whose sides is the number inside Fibonacci sequence and
the arcs which will form the spiral.
n: is the number that will be the side of the squares and the radius of the arc in the
fibonacci sequence.
Tortoise: is the turtle who will draw the square.
Return Value:
for segment in range(4): #Loop index is defined as 4 for loop function for square
def main():
This is the main function to draw the Fibonacci spiral as it calls the other fucntions that calculates the fibonacci sequence and drawas the squares and arcs based on the calculations
n=int(input('How many layers: ')) #Asks user to input the number of layers
for i in range(n+1): #Loop index is defined as n+1 for loop function

ImportErrorTraceback (most recent call last)
in ()
7 This programe helps us draw the fibonacci spiral based on the input of number of layers from the user.
8 “”"
----> 9 import turtle
10 tortoise=turtle.Turtle()
11 def fib(n):

/usr/lib/python2.7/lib-tk/turtle.py in ()
105 #print _ver
–> 107 import Tkinter as TK
108 import types
109 import math

/usr/lib/python2.7/lib-tk/Tkinter.py in ()
40 import _tkinter
41 except ImportError, msg:
—> 42 raise ImportError, str(msg) + ‘, please install the python-tk package’
43 tkinter = _tkinter # b/w compat for export
44 TclError = _tkinter.TclError

ImportError: No module named _tkinter, please install the python-tk package


Hi Ang, these are forums for questions about Atom and Electron.

Please make sure you can run your code in the command line before asking about any issues here.


Hey Aerijo , my code is working fine with IDLE , however when I try running it in atom using hydrogen. It gives me the error.


What happens when you run the code with script?


Because turtle.py imports it, as the stack trace you posted says.

The IPython interpreter is separate from IDLE’s interpreter on your computer. Without looking, I’m 100% positive that they have different packages installed, but I don’t know how to install new packages for Jupyter.