PDA

Voir la version complète : Python : Boîte de dialogue asynchrone



César Vonc
20/04/2012, 10h27
Bonjour,


Je cherche à créer une boîte de dialogue non modale avec un script Python dans la R13.051.

J'utilise donc le code qui suit :


import c4d
from c4d import gui

class Dialogue(gui.GeDialog) :
def CreateLayout(self) :
self.AddButton(10, c4d.BFH_SCALEFIT, inith = 20, name = "Fermer")
return True

def Command(self, id, msg) :
if id == 10 :
self.Close()
return True

def main() :
dial = Dialogue()
dial.Open(c4d.DLG_TYPE_ASYNC)

if __name__=='__main__':
main()
Ma fenêtre s'ouvre, mais le bouton ne marche pas et disparaît lorsque je redimensionne la boîte, comme si elle avait planté.

La console n'affiche pourtant aucune erreur et la boîte de dialogue marche bien en mode modale.


Ai-je oublié quelque chose ?

xs_yann
20/04/2012, 22h39
Salut César,

A priori tu ne peux pas ouvrir de dialogue non-modal depuis le script manager.


In your code you forgot to pass the ID to GeDialog.Open (2nd arg). If you open an asynchronous dialog you have to pass the pluginid.

Edit:
Btw,you dont need to pass them in synchronous dialogs.

http://www.plugincafe.com/forum/forum_posts.asp?TID=5873&PID=24629#24629


>> My main intention is to open ASYNC Dialogs within the Script Manager.

Unfortunately this is not possible and asynchronous dialogs are not intended to be opened from the script manager.

http://www.plugincafe.com/forum/forum_posts.asp?TID=5805&PID=24226#24226

Bonne soirée. ;)

César Vonc
20/04/2012, 23h33
Ah d'accord, dommage. Merci pour l'info !