Quick Python question, if anyone can help:
How can I create a script to call up an image? The said script creates a Win32 Console and displays interactive messages and responses, in a simple way. I want to have that same script call up an image with certain responses, and I was thinking that the best end to that mean would be to use a COM server to call up a System-intrinsic viewing program (the script is only suited for Win32 systems), and direct it to open a specific directory and image corresponding with the response printed to the console. Thank you for any help!
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
I work on Linux, so I can't offer much advice about Windows, but you can just make a system call in Python which should do what you want.
cmd = 'some system command'
I use IPython and I've got a bunch of hooks for this type of stuff set up, but I usually send images, pdfs and that kind of stuff to my web-browser, Chrome. I don't have much of a desktop, I'm on fluxbox day to day, so this works for me. You might want to consider writing a real simple server, Bottle is good for this, and then running that locally and firing up Chrome passing some URL your server will know what to do with.
Let me know where you're at and I'll try and be more specific. I'll offer a few tips on using Bottle as well if it interests you.
Thank you for your assistance, but I have no idea how to implement a server in the way you mentioned. The usage of the web browser is actually a great alternative method, but can you create the server and send the image on cue and still maintain a "blackbox" effect? (i.e.; user doesn't know that a server is being set up and no confusing prompts ask for their input, etc)
Also, is Bottle a Python module or another program? And, since the server is local, are there any registry entries or temporary files/directories that would be left behind requiring cleanup?
I would be extremely thankful for any help!
Yes, Bottle is a Python module, it's a single module, you can just grab a copy of bottle.py and drop it in.
You can run the server locally like any other app and it should behave like any other app ~ once it quits, it shouldn't leave any files behind unless you've told it to explicitly. Your server can return images or web pages containing images when ever it is told to by the client, a browser normally.
In a simple set up, the user would start the application in the normal way and the app would be the server. Once the server is running, you'd need to make a request to it from the browser, but you could bookmark the page to request in the browser.
You could also write a little script that'll fire up the server as a background app, then, once it's running, fire up your browser, passing the url of the local server as a command line argument. That way the browser will fire up and immediately open at your page. I'm not sure how you'd do this on Windows, but I reckon it'd be easy enough to figure out.
It can be wrapped up so the user doesn't have to do anything technical, but it'd be obvious to anyone at all familiar with a computer that you're running a server locally and that is what's providing services to the browser. There's normally no harm in this though.
I've attached a copy of bottle.py
Not the answer you are looking for? Search for more explanations.
To actually use the server, you'll be needing these docs...
I'm pretty sure this is the latest version, so just follow the instructions on the above page. The new tutorials wont work with the old versions.
Let me know how you get on.