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

How to hide wxPython warnings ? #259

Closed
dschiller opened this issue Feb 16, 2023 · 7 comments
Closed

How to hide wxPython warnings ? #259

dschiller opened this issue Feb 16, 2023 · 7 comments

Comments

@dschiller
Copy link

dschiller commented Feb 16, 2023

When executing the following script I get warnings like:

WxPython is not found for the current python version.
Pyo will use a minimal GUI toolkit written with Tkinter (if available).
This toolkit has limited functionnalities and is no more
maintained or updated. If you want to use all of pyo's
GUI features, you should install WxPython, available here:
http://www.wxpython.org/


Neither WxPython nor Tkinter are found for the current python version.
Pyo's GUI features are disabled. For a complete GUI toolkit, you should
consider installing WxPython, available here: http://www.wxpython.org/
from signal import sigwait, SIGINT
from pyo import *
import os
import contextlib
import warnings

s = Server()
with open(os.devnull, "w") as f, contextlib.redirect_stdout(f):
    warnings.filterwarnings('ignore', category=PendingDeprecationWarning)
    s.boot()
s.start()

# Sets fundamental frequency.
freq = 187.5

# Roland JP-8000 Supersaw emulator.
lfo4 = Sine(0.1).range(0.1, 0.75)
osc4 = SuperSaw(freq=freq, detune=lfo4, mul=0.3).out()

# Interpolates between input objects to produce a single output
sigwait([SIGINT])
s.stop()
s.shutdown()

I don't want install wxPython but use pyo without those warnings. Is that possible to hide the warnings ?

@lextoumbourou
Copy link

Set PYO_GUI_WX environment variable to be 0 will hide that warning.

export PYO_GUI_WX=0

@dschiller
Copy link
Author

dschiller commented Feb 21, 2023

Seems not to work:

from pyo import Server, Sine, SuperSaw, time
from PyQt5.QtWidgets import QApplication, QWidget
import threading
import sys
import os

os.environ['PYO_GUI_WX'] = '0'


class Sound:

    def __init__(self):
        self.server = Server()
        self.server.deactivateMidi()
        self.server.setBufferSize(512)

    def start(self):
        self.server.boot().start()

    def stop(self):
        self.server.stop()

    def _synth(self):
        # Sets fundamental frequency.
        freq = 187.5

        # Roland JP-8000 Supersaw emulator.
        lfo4 = Sine(0.1).range(0.1, 0.75)
        osc4 = SuperSaw(freq=freq, detune=lfo4, mul=0.3).out()

        while True:
            time.sleep(.0001)

    def synth(self):

        self.synth_thread = threading.Thread(target=self._synth, daemon=True)
        self.synth_thread.start()


class Window(QWidget):

    def __init__(self):
        super().__init__()
        self.show()

        self.sound = Sound()
        self.sound.start()
        self.sound.synth()

    def closeEvent(self, event):
        self.sound.stop()
        return super().closeEvent(event)


app = QApplication([])
window = Window()
sys.exit(app.exec_())
WxPython is not found for the current python version.
Pyo will use a minimal GUI toolkit written with Tkinter (if available).
This toolkit has limited functionnalities and is no more
maintained or updated. If you want to use all of pyo's
GUI features, you should install WxPython, available here:
http://www.wxpython.org/


Neither WxPython nor Tkinter are found for the current python version.
Pyo's GUI features are disabled. For a complete GUI toolkit, you should
consider installing WxPython, available here: http://www.wxpython.org/

Pyo warning: Portaudio input device `MacBook Pro Mikrofon` has fewer channels (1) than requested (2).

@belangeo
Copy link
Owner

belangeo commented Feb 21, 2023 via email

@dschiller
Copy link
Author

dschiller commented Feb 21, 2023

Makes sense. Thanks Oliver and Lex!

@dschiller
Copy link
Author

But still getting a bit of output regarding WxPython and Tkinter:

from PyQt5.QtWidgets import QApplication, QWidget
import threading
import sys
import os

os.environ['PYO_GUI_WX'] = '0'

from pyo import Server, Sine, SuperSaw, time  # noqa


class Sound:

    def __init__(self):
        self.server = Server()
        self.server.deactivateMidi()
        self.server.setBufferSize(512)

    def start(self):
        self.server.boot().start()

    def stop(self):
        self.server.stop()

    def _synth(self):
        # Sets fundamental frequency.
        freq = 187.5

        # Roland JP-8000 Supersaw emulator.
        lfo4 = Sine(0.1).range(0.1, 0.75)
        osc4 = SuperSaw(freq=freq, detune=lfo4, mul=0.3).out()

        while True:
            time.sleep(.0001)

    def synth(self):
        self.synth_thread = threading.Thread(target=self._synth, daemon=True)
        self.synth_thread.start()


class Window(QWidget):

    def __init__(self):
        super().__init__()
        self.show()
        self.sound = Sound()
        self.sound.start()
        self.sound.synth()

    def closeEvent(self, event):
        self.sound.stop()
        return super().closeEvent(event)


app = QApplication([])
window = Window()
sys.exit(app.exec_())
Neither WxPython nor Tkinter are found for the current python version.
Pyo's GUI features are disabled. For a complete GUI toolkit, you should
consider installing WxPython, available here: http://www.wxpython.org/

Pyo warning: Portaudio input device `MacBook Pro Mikrofon` has fewer channels (1) than requested (2).

@belangeo
Copy link
Owner

belangeo commented Feb 21, 2023 via email

@jacksongoode
Copy link

Can this be fixed?

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

4 participants