我使用以下脚本在pyqgis中创建了一个工具栏和一个工具栏按钮:
import { fromEvent, Observable, of, defer, interval, empty, concat, from} from 'rxjs';
import { map, catchError, mergeMap, concatAll, filter,reduce, scan } from 'rxjs/operators';
import { ajax} from 'rxjs/ajax';
import {Subject} from 'rxjs';
var input1 = document.querySelector('#input1');
var input2 = document.querySelector('#input2');
var span = document.querySelector('span');
var obs = fromEvent(input1, 'input');
var subs=obs.subscribe(event => span.textContent=event.target.value);
function App() {
return (
<div className="App">
<div style={{marginTop:'100px'}} >
<div style={{padding:'10px'}}>
<input type="text" id="input1"></input>
</div>
<div>
<input type="text" id="input2"></input>
</div>
</div>
<p> Combined Value:<span></span></p>
</div>
);
}
export default App;
此外,我有一个简单的python脚本,可以执行简单的操作,例如:
from PyQt5 import QtCore, QtGui, QtWidgets
toolbar = iface.addToolBar(u'My toolbar')
iface.toolButton = QToolButton()
iface.toolButton.setIcon(QIcon("myIcon.png"))
toolbar.addWidget(iface.toolButton)
如何将“ def my_action()”脚本连接到上面的按钮。以便在用户单击按钮时调用my_action函数?