Терминал Python в HTML? - PullRequest
0 голосов
/ 06 мая 2018

Вы можете понизить это, прежде чем читать (Редактировать: Спасибо за понимание) из-за названия, но другие вопросы просто отвечают, как запускать программы на python в html, но я хочу использовать терминал python в html.

Так что, ребята, в моей голове действительно большой вопрос. Как именно я могу использовать программу на Python в HTML, как это терминал.

Вот мой проект, это будет интерактивный словарь, который вы можете изучать по словарю.

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
    font-family: Arial
}

* {
    box-sizing: border-box;
}

/* The browser window */
.container {
    border: 3px solid #f1f1f1;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

/* Container for columns and the top "toolbar" */
.row {
    padding: 10px;
    background: #f1f1f1;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.scriptcontainer {
    padding: 10px;
    background: #ffffff;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.row2 {
    padding: 5px;
    background: #cc0000;
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

/* Create three unequal columns that floats next to each other */
.column {
    float: left;
}

.left {
    width: 15%;
}

.right {
    width: 10%;
}

.middle {
    width: 75%;
}

/* Clear floats after the columns */
.row:after {
    content: "";
    display: table;
    clear: both;
}

/* Three dots */
.dot {
    margin-top: 4px;
    height: 12px;
    width: 12px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
}

/* Style the input field */
input[type=text] {
    width: 100%;
    border-radius: 3px;
    border: none;
    background-color: white;
    margin-top: -8px;
    height: 25px;
    color: #666;
    padding: 5px;
}



.bar {
    width: 17px;
    height: 3px;
    background-color: #aaa;
    margin: 3px 0;
    display: block;
}

/* Page content */
.content {
    padding: 10px;
}
</style>
</head>
<body>

<div class="container">
  <div class="row">

    <div class="column middle">
        <h4><font size="6" type="Times">VocaDict</font></h4>
   </div>

  </div>

  <div class="content">
    <h3>=>Your dictionary:</h3>
      <div class="row2"><div class="content"><div class="scriptcontainer">        <script>//This is where your dictionary will go!</script></div></div></div>
      </div>

      <div class="content">
    <h3>=>Study lists:</h3>
      <div class="row2"><div class="content"><div class="scriptcontainer">    <script>//This is where your dictionary will go!</script></div></div></div>
      </div><br><br><br><br><br><br><br><br> <br><br><br><br><br><br><br>    <br><br><br><br><br><br><br><br><br><br>

  </div>


</body>
</html> 

Я спрашиваю об этих местах:

<div class="content"><div class="scriptcontainer">    <script>//This is the place I want python terminal to be!</script>

Я хочу, чтобы эти места действовали как терминал Python. Когда страница загружается, она запускает программу, она не влияет ни на что другое и действует как независимая вещь, но она останется на странице и будет интерактивной.

Возможно ли это, и если да, то как?

Спасибо!

1 Ответ

0 голосов
/ 06 мая 2018

Что вы пытаетесь сделать здесь точно? Если вы действительно хотите запустить скрипт Python с HTML, тогда переходите на CGI. Поскольку вы не можете запускать Python напрямую, вам, возможно, придется использовать ниже,

http://karrigell.sourceforge.net/en/pythoninsidehtml.html

или

http://www.skulpt.org/

Но лучшим способом было бы использовать программирование на python-cgi https://www.tutorialspoint.com/python/python_cgi_programming.htm

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...