Making GUI with only python without framework?
<ol>
<li>Is it possible to create a user interface without the help of python framework (like tinker or pygame) and use only vanilla python code? If yes, how?</li>
<li>Can you briefly explain how python framework works?</li>
<li>Is the code of different python framework different?</li>
<li>If the computer did not have the framework installed, will the program still runnable if the program uses a framework?
Thanks very much</li>
</ol>

<p>If you want as few external dependencies as possible (but still a GUI) I would strongly suggest using a Web-Microframework like <a href="http://bottlepy.org/docs/dev/index.html" rel="nofollow">bottle</a> (single file) and utilize the user's browser for rendering.</p>

<ol>
<li>You can make a GUI without any external framework with HTML by setting up a webserver and using the user's browser to render it.</li>
<li>For a browser-GUI without an external Framework: Depending on whether you know JavaScript you can either use XML-RPC (<a href="https://docs.python.org/3/library/xmlrpc.server.html" rel="nofollow">xmlrpc.server</a>+<a href="https://docs.python.org/3/library/http.server.html#http.server.SimpleHTTPRequestHandler" rel="nofollow">http.server</a> with JS in the browser) or WSGI (<a href="https://docs.python.org/3/library/wsgiref.html" rel="nofollow">wsgiref</a>) (example on that page)</li>
<li>Yes, totally.</li>
<li>Of course the if you do not prepare for this case you cannot run a program without an integral part of it like a Framework - but you can distribute your program with the Framework included.</li>
</ol>

<p>For XML-RPC</p>

<pre><code>import xmlrpc.server
import http.server

class MyHandler(xmlrpc.server.SimpleXMLRPCRequestHandler,http.server.SimpleHTTPRequestHandler):
    pass 
</code></pre>

<p>This handler will serve files from the current working directory (your actual HTML-UI and JS for communication (there are several XMP-RPC libraries for JS)) but it can also be used like in the <a href="https://docs.python.org/3/library/xmlrpc.server.html#simplexmlrpcserver-example" rel="nofollow">XML-RPC-Server example</a> to glue your code and the UI together.</p>

python user-interface frameworks