Nov-18-2022, 07:29 PM
(This post was last modified: Nov-18-2022, 07:29 PM by Krissstian.)
(Nov-18-2022, 06:56 PM)deanhystad Wrote: In a post about a button command that closes a window I would expect to see code that creates a button and binds it to a command that closes the window.
Sorry, this is my button command:
show_map = Button(root, text='SHOW', font=("", 10), command=Map, width="10") show_map.grid(row=0, column=5, padx=5, pady=0)And this is def:
class MyApp(QWidget): def __init__(self): super().__init__() self.setWindowTitle('Map') self.window_width, self.window_height = 1366, 768 self.setMinimumSize(self.window_width, self.window_height) layout = QVBoxLayout() self.setLayout(layout) coordinate = (latitude, longitude) m = folium.Map( tiles='Stamen Terrain', zoom_start=6, location=coordinate ) folium.Marker(location=[latitude, longitude]).add_to(m) # save map data to data object data = io.BytesIO() m.save(data, close_file=False) webView = QWebEngineView() webView.setHtml(data.getvalue().decode()) layout.addWidget(webView) if __name__ == '__main__': app = QApplication(sys.argv) app.setStyleSheet(''' QWidget { font-size: 35px; } ''') myApp = MyApp() myApp.show() try: sys.exit(app.exec_()) except SystemExit: print('Closing Window...')Problem is after i press the button and plot the result on map, the command it not stop execute...