alexdlaird / pyngrok

A Python wrapper for ngrok
https://pyngrok.readthedocs.io
MIT License
416 stars 59 forks source link

Py Ngrok WIndow #102

Closed Ricc4rdo0107 closed 1 year ago

Ricc4rdo0107 commented 1 year ago

I would very much like that when I save the file in .pyw format and run it there is a way to hide the ngrok window. If there is already a method I would like to know. Thank you so much

alexdlaird commented 1 year ago

Can you provide a working example of this? I don't think the CLI should be necessary if you're using the API programmatically, so I'm not sure why that window would stand open, but perhaps the ngrok process forces it to stay open—I'd need a PYW code example to be able to work out this enhancement though, it's not something I've worked with to support or even test with pyngrok to this point.

Vervixer commented 1 year ago

You can try this with official TCP server example. Just save the file not as .py but as .pyw and run it with cmd console (If you're on Windows) as you normally run .py scripts. The expected result is that there won't be any opened windows, but instead there is ngrok's one.

alexdlaird commented 1 year ago

I've never done GUI development in Python, but that example does utilize the command prompt with stdout, would that not populate a console window then?

I'm also not on Windows, but do you see the same issue with a pyw script that has only the most basic ngrok usage from pyngrok?

from pyngrok import ngrok

# Open a HTTP tunnel on the default port 80
# <NgrokTunnel: "http://<public_sub>.ngrok.io" -> "http://localhost:80">
http_tunnel = ngrok.connect()
Ricc4rdo0107 commented 1 year ago

Its just this function

def ngrokserver():
    tunnel = ngrok.connect(9999, "tcp")
    return tunnel

when I start the program I would like to see only the pygame GUI and not the ngrok black screen, even if I add the ".pyw" extension it persists, thanks for being helpful :D

github-actions[bot] commented 1 year ago

This issue is stale because it has remained open with no further activity on it. Comment with additional context or the issue will be closed automatically. Thank you for your contribution!

alexdlaird commented 1 year ago

To close the loop on this, this is expected behavior from ngrok. We do not presently have any enhancements on the roadmap to allow users to opt out of this behavior (and also I'm not sure that's possible), but certainly any community investigation and/or PRs to add support that hides this window would be evaluated. Until then, the ticket has been closed.

Ricc4rdo0107 commented 1 year ago

Ok, thank you very much for the support!!