Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
I need to use pyside for my plugin's GUI. And i run Pyside in another C4Dthread. It is possible to successfully open the Pyside window in C4D. but there seem to be some problems.
-1.When I opened the Pyside window in C4D, the main thread seemed to be blocked, which made it impossible for me to interact with the C4D scene.
-2.When I first open the Pyside window, it will open normally, but when I close it and open it again, it will flicker on the screen and open it again, that is to say; After closing the window for the first time, I need to click twice to open the window.
And this is my code example:
class Window(QMainWindow): def __init__(self): super(Window,self).__init__() self.InitUI() def InitUI(self): self.setWindowTitle("Pyside Test") self.resize(500,400) self.move(200,200) label = QLabel(self) label.setText("Pyside Test") label.setAlignment(Qt.AlignCenter) class UIThread(C4DThread): def Main(self): # Put in your code here # which you want to run # in another thread app = QApplication.instance() if not app: app = QApplication([]) win = Window() win.show() app.exec_() def main(): thread = UIThread() thread.Start(c4d.THREADMODE_ASYNC, c4d.THREADPRIORITY_NORMAL) # Do some other operations here thread.Wait(True) # Wait until the main method is done print "Pyside for c4d" thread.End(True)
@gheyret Hello~~
@gheyret Is anyone here?
Hi @gheyret,
thank you for reaching out to us. It is unfortunately not quite cleae to me in which context (Script Manager script, CommandData plugin, etc.) your problem occurs. Please try to include such context in the future, as it is not always obvious from the code and quite important. I all answer the rest in bullet point from most important to less important.
CommandData
Qt
Thank you for your understanding, Ferdinand
@zipit Thanks to replying me! And looks like i need to try it in "CommandData plugin ", hope it works~ Cheers!
Hi,
just to be really unambiguous: You can try, but I personally would really recommend a server-client model, since you will always be on unsafe ground doing this in Cinema. And it is hard to plan for all eventualities, until we specifically design Cinema's Python API for being cable of this. As already pointed out, we will not be able to offer support if you decide to take that route and it does not work out.
Cheers and thank you for your understanding, Ferdinand
@zipit I just read this(Connect C4D with Tkinter) post,It does seem to help me Thank you again!