2

我在这里提出一个问题,即是否可以连接 wxpython(GUI)和 shell(bash)(后端)脚本。从 ftp 下载文件并将其安装在系统上并运行许可证文件?

提前感谢您的帮助,如果你们有,请分享该过程的示例代码,,,

4

1 回答 1

1

使用 python,您可以执行以下操作:

#!/usr/bin/env python
#-*- coding:utf-8 -*-

import wx, os

script = "/path/to/script"

class myFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, 'wxButton')
        self.button = wx.Button(self, id=-1, label='Click Me!')
        self.button.Bind(wx.EVT_BUTTON, self.on_button_click)

        self.Show(True)

    def on_button_click(self, event):
        os.system(script)

app  = wx.PySimpleApp()
main = myFrame()
app.MainLoop()

将 的值替换为script脚本的实际路径。

于 2013-01-05T16:06:14.070 回答