Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odd error in attempts to run audio_spectrum.py #3

Open
zipzit opened this issue Mar 25, 2018 · 2 comments
Open

Odd error in attempts to run audio_spectrum.py #3

zipzit opened this issue Mar 25, 2018 · 2 comments

Comments

@zipzit
Copy link

zipzit commented Mar 25, 2018

I'm a bit new to Python and some of the modules used here. Odd errors, that I'm just unable to troubleshoot.

 thismanager.window.setGeometry( 5, 120, 1910, 1070)
  File "/usr/lib/python3.5/tkinter/__init__.py", line 1952, in __getattr__
    return getattr(self.tk, attr)
AttributeError: '_tkinter.tkapp' object has no attribute 'setGeometry'

I'm using Python3 on a Xubuntu (Ubuntu with XFCE) in a virtualbox. I've tested pyAudio samples so I know microphone (and speakers) are fully functional. Running in a Python virtual environment.

Note: I'm able to run $ python3 audio_spectrumQT.py successfully in the same virtualbox. Works just fine.

Any clue as to what's going on here?

Many thanks to Mark Jay for the youtube videos and this github repo, enabling us to better learn how Fast Fourier Transforms (FFT) work.

reference:

Let's Build an Audio Spectrum Analyzer in Python! (pt. 1) the waveform viewer.
https://www.youtube.com/watch?v=AShHJdSIxkY
Mark Jay        Published on Sep 9, 2017

Let's Build an Audio Spectrum Analyzer in Python! (pt. 2) the spectrum viewer
https://www.youtube.com/watch?v=aQKX3mrDFoY
Mark Jay        Published on Sep 10, 2017

Let's Build an Audio Spectrum Analyzer in Python! (pt. 3) Switching to PyQtGraph
https://www.youtube.com/watch?v=RHmTgapLu4s
Mark Jay        Published on Oct 8, 2017
@zipzit
Copy link
Author

zipzit commented Mar 26, 2018

Been attempting to learn what's going on here... I'm coming from a heavy JavaScript/node background with mere familiarity with Python. Been studying up on numpy and matplotlib.pyplot

# show axes
thismanager = plt.get_current_fig_manager()
thismanager.window.setGeometry(5, 120, 1910, 1070)
plt.show(block=False)

I'm way confused by the comment # show axes Is that what you are doing here, displaying the axes on a two plot figure?

When I go to source, In [xx]: matplotlib.pyplot.figure?
I see:

Signature: matplotlib.pyplot.figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=<class 'matplotlib.figure.Figure'>, **kwargs)
Docstring:
Creates a new figure.
...
figsize : tuple of integers, optional, default: None
    width, height in inches. If not provided, defaults to rc
    figure.figsize.

I see nothing that remotely matches up to (5, 120, 1910, 1070) Am I analyzing this correctly?

Oh, wait...

I just found this stackoverflow posting... looks like thismanager.window is a tkinter thing (?)

Perhaps one of the flavors of figManager.window.showMaximized() (as shown in the responses to the stackoverflow question above) are more appropriate for this exercise?

@markjay4k
Copy link
Owner

you can remove the line for setGeometry. I only used it so the window would pop up in the center of why screen where I record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants