I am a beginner to Eclipse neon + Pydev combo. Trying to use python modules I created into other modules I will be creating. For a start, I was going to use TKinter tutorial program outlined here: http://effbot.org/tkinterbook/tkinter-hello-again.htm
In addition to printing a statement in response to a mouse click, I want to run a small module, fibo.py
Here's my code:
import the library
from tkinter import *
import fibo
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
self.button = Button(
frame, text="QUIT", fg="red", command=frame.quit
)
self.button.pack(side=LEFT)
self.hi_there = Button(frame, text="Hello",command=self.say_hi)
self.hi_there.pack(side=LEFT)
def say_hi(self):
fib(100)
print ("hi there, everyone!")
root = Tk()
app = App(root)
root.mainloop()
root.destroy() # optional; see description below
Here's fibo.py
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
print (b, end=" ")
a, b = b, a+b
def fib2(n): # return Fibonacci series up to n
result = []
a, b = 0, 1
while b < n:
result.append(b)
a, b = b, a+b
return result
Both modules are in the same project and workspace. The editor says,"unresolved import fibo" Why is the module fibo not recognized by in pydev/eclipse?
My ultimate goal is to run a module upon button click. If there's a more direct way to accomplish this, I would like to know.