python 界面参数传递_如何使用烧瓶将参数传递给电子用户界面?

我建议您应该将electron应用程序用作flask应用程序的UI。这意味着您可以使用electron启动flask服务器,然后导航到electron UI中的url。

下面是一个如何执行此操作的示例:app.on('ready', function() {

//call python?

var subpy = require('child_process').spawn('python', ['./hello.py']);

var rq = require('request-promise');

var mainAddr = 'http://localhost:5000';

var openWindow = function(){

// Create the browser window.

mainWindow = new BrowserWindow({width: 800, height: 600});

// and load the index.html of the app.

// mainWindow.loadURL('file://' + __dirname + '/index.html');

mainWindow.loadURL('http://localhost:5000');

// Open the devtools.

mainWindow.webContents.openDevTools();

// Emitted when the window is closed.

mainWindow.on('closed', function() {

// Dereference the window object, usually you would store windows

// in an array if your app supports multi windows, this is the time

// when you should delete the corresponding element.

mainWindow = null;

// kill python

subpy.kill('SIGINT');

});

};

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值