Hi, @borbs727 @LazyDodo
I am trying to make a GUI window using python API in Blender. I have tried kivy, PyQt, PySide2, whenever my code execute ones, the GUI window appears according to my program but it completely freezes the blender. I can only minimize and maximize it. And as soon as I close the GUI window, the blender gets crash. I am unable to solve the problem.
I have tried following programs with these GUI tools:
First program with kivy :
###########################################
import kivy
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text = "Oh hello")
if __name__ == '__main__':
MyApp()
###########################################
Second program with PyQt:
###########################################
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel
import sys
def main():
app = QApplication(sys.argv)
win = QMainWindow()
win.setGeometry(200,200,300,300)
win.setWindowTitle("My first window!")
label = QLabel(win)
label.setText("my first label")
label.move(50, 50)
win.show()
sys.exit(app.exec_())
main()
###########################################
Third program with PySide2 :
###########################################
from PySide2.QtWidgets import QApplication, QWidget
import sys
class Window(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle("Pyside2 Simple Appplication")
self.setGeometry(300,300, 500,400)
myApp = QApplication(sys.argv)
window = Window()
window.show()
myApp.exec_()
sys.exit(0)
###########################################
I have also tried to plot a graph using matplotlib.pyplot. Same problem is there with blender. When the graph window appears after execution of code, blender gets freeze. But luckily in this case it does not crash on closing the window.
The program with matplotlib is:
###########################################
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0,20,1000)
y = 2*x
plt.plot(x,y)
plt.xlabel('input(x)')
plt.ylabel('output')
plt.title('plot')
plt.plot(x,y,'2'), plt.plot(y,x)
plt.show()
###########################################
If you have found any solution, please share with me. Thanks!