Thanks for your valuable reply facing another problem similar like this I am posting my error and code below please provide your suggestion
Error faced is described below:
Backend TkAgg is interactive backend. Turning interactive mode on.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\LM HealthCare\AppData\Local\Programs\Python\Python37-32\lib\tkinter\__init__.py", line 1705, in __call__
return self.func(*args)
File "C:\Users\LM HealthCare\Documents\Pycharm\Projects\EEG\EEG.py", line 47, in click
Click_Listner.Start_click(line)
AttributeError: module 'Click_Listner' has no attribute 'Start_click'
Code for EEG.py
from tkinter import *
import numpy as np
import Digital_Filter
import array as arr
import matplotlib.pyplot as plt
import Click_Listner
import Test
# some program constants
alpha_band_Hz = [8.0, 10.5] # where to look for the alpha peak
noise_band_Hz = [14.0, 20.0] # was 20-40 Hz
NFFT = 400 # pitck the length of the fft
fs_Hz = 100.0 # assumed sample rate for the EEG data
f_lim_Hz = [0, 40] # frequency limits for plotting
t_lim_sec = [0, 0] # default plot time limits [0,0] will be ignored
alpha_lim_sec = [0, 0] # default
output = [] # Array to store float data coverted from string
main = Tk()
# Reading text file in
def read_file():
with open("C:\\Users\\LM HealthCare\\Desktop\\Desktop C drive desktop\\EEG,ECG txt Data\\delta_Band_Power.txt", "r") as f:
eeg_data = f.read()
eeg_data = eeg_data.split('\n')
n = 0
for line in eeg_data:
line1 = float(eeg_data[n])
output.append(line1)
n += 1
# Applying filters
Filtered_Data = Digital_Filter.apply_filter1hz_Highpass(output)
t_sec = np.array(range(0, Filtered_Data.size)) / 250
#ax[0].plot(t_sec, Filtered_Data, color='green')
Filtered_Data = Digital_Filter.apply_filter60hz_Notch(Filtered_Data)
#ax[1].plot(t_sec, Filtered_Data, color='red')
Filtered_Data = Digital_Filter.apply_filter120hz_Notch(Filtered_Data)
return Filtered_Data
# Functions for click events
def click():
Test.Ft_data=read_file()
for line in Test.Ft_data:
Click_Listner.Start_click(line)
# Setting Main Window of the Application
main.title('NeuroCare')
screen_width = main.winfo_screenwidth()
screen_height = main.winfo_screenheight()
main_Window_width = screen_width - 8
main_Window_height = screen_height - 90
main.geometry("{}x{}+{}+{}".format(main_Window_width, main_Window_height, -5, -3))
main.resizable(0, 0)
Filtered_Data = []
# Adding menubar and menu options
menu = Menu(main)
menu.bg = 'black'
main.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label='New')
editmenu = Menu(menu)
menu.add_cascade(label='Edit', menu=editmenu)
# Adding Toolbar options
toolbar = Frame(main.master, bd=1, relief=RAISED, bg='light blue')
New_button = Button(toolbar, text='Start', activebackground='light grey', command=click ).pack(side=LEFT, padx=2, pady=2)
toolbar.pack(side=TOP, fill=X)
# Add a canvas to plot eeg waves
eeg_canvas = Canvas(main, bg='yellow', width=main_Window_width, height=main_Window_height - 40, relief = SUNKEN).pack(fill=X, side="top")
Raw_data = []
#plt.plot(output, 'k-', label='input')
#plt.show()
# fig, ax = plt.subplots(2,1)
#
#
# ax[0].plot(t_sec, Filtered_Data, color='blue')
# ax[0].set_ylim(-100, 100)
# ax[0].set_xlim(0, 30)
# ax[0].set_ylabel('EEG (uV)')
# ax[0].set_xlabel('Time (sec)')
#
# plt.ylim(-100, 100)
# plt.ylabel('EEG (uV)')
# plt.xlabel('Time (sec)')
# plt.xlim(70, 120)
#Filtered_Data = Filtered_Data.__format__('%.5f')
#plt.show()
#plt.plot(Filtered_Data, 'b-', linewidth=1.5, label='filtered')
#plt.show()
#Filtered_Data = Filtered_Data.split('\n')
x=10
main.mainloop()
Code for click_listner:
import Functions
#import Test
def Start_click(xvalue):
# for line in Test.Ft_data:
Functions.dataEnter = True
Functions.Print_Canavas(xvalue)
# x=True
Code for functions:
import EEG
currentX = 0
lastX = 0
y1 = 200
y2= 200
dataEnter = False
def Print_Canavas(xvalue):
currentx = lastX + 0.1
if dataEnter == True :
EEG.eeg_canvas.create_line(lastX, y1, currentX , (y2-xvalue), fill = 'Green')
EEG.eeg_canvas.create_line(0, 50 * 2, 400, 50 * 2)
y1= ( y2 - xvalue )
dataEnter = False
lastX = currentX
if lastX == EEG.eeg_canvas.width:
lastx = 0
Code for Test:
Ft_data=[]