Note that there are some explanatory texts on larger screens.

plurals
  1. POEmbed vte. How to do the same as this PyGtk app with wxPython?
    primarykey
    data
    text
    <p>It's my first post. I read a lot of subjects per day on Stackoverflow, and i appreciate to find there some help. And today it's my turn to ask a question because i didn't find solution to my need.</p> <p>I want to have a terminal in the app i'm writing; i(ve read a lot about a lots (subprocess, thread, pty, etc, etc), but i didn't find a simple solution as this one written with pygtk and vte. Here is the code:</p> <pre><code>#!/usr/bin/env python # -*- coding: utf-8 -*- import pygtk pygtk.require('2.0') import gtk, vte window = gtk.Window() window.resize(600,400) window.show() term = vte.Terminal() pid = term.fork_command('bash') term.set_emulation('xterm') term.show() window.add(term) window.show_all() window.connect("destroy", lambda w: gtk.main_quit()) gtk.main() </code></pre> <p>Do you know a way to do that with wxPython?</p> <p>Thanks a lot for your help, many thanks!! :)</p> <p><strong>Edit0:</strong></p> <p>I have to precise that:</p> <ul> <li>i'm talking about a bash shell (as in the code above), not a python shell</li> <li>i write it for linux </li> </ul> <p><strong>Edit1:</strong></p> <p>Thanks for your answers! :)</p> <p>Joran, i've read already this question, and i've tried all the code proposed. Although it's interesting, that's not the way i want to do it as you can see in my question. It seems to be very difficult to write an app that recreate a terminal emulator.</p> <p>That's why i'm searching for a solution like the code i proposed.</p> <p>pythonm, i don't see the relation between your idea and my question...</p> <p>Thanks for your help!</p> <p><strong>Edit2</strong></p> <p>Please look at this short code:</p> <pre><code>#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import pty shell = os.environ['SHELL'] script = open('typescript', 'w') def read(fd): data = os.read(fd, 1024) script.write(data) return data pty.spawn(shell, read) </code></pre> <p>Any idea to "put" this in a widget with wxpython?</p> <p><strong>Edit3</strong></p> <p>Look that too:</p> <pre><code>#!/usr/bin/env python # -*- coding: utf-8 -*- import pexpect c = pexpect.spawn ('bash -i') c.interact() c.kill(1) </code></pre> <p>So simple and so easy to do...</p> <p>Tell me if it's impossible to embed that in a wx widget.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload