2017-04-10 11 views
-3

ich eine Meldung erhalten,Namen '...' ist nicht definiert

Traceback (most recent call last): 
File "<input>", line 1, in <module> 
NameError: name 'update' is not defined 

Der ursprüngliche Code

from PySide import QtCore 

    i = 0 
    def update(); 
    global i 
App.getDocument("Unnamed2").Pad001.Placement=App.Placement(App.Vector(0,127.5,0), App.Rotation(App.Vector(0,0,1),-i), App.Vector(0,0,0)) 
App.getDocument("Unnamed2").Pad.Placement=App.Placement(App.Vector(0,0,0), App.Rotation(App.Vector(0,0,1),i*(74.0/28.0)), App.Vector(0,0,0)) 
i += 0.01 

    timer = QtCore.QTimer() 
    timer.timeout.connect(update) 
    timer.start(1) 

ist Es ist Code für einen Gang Animation, aber es funktioniert nicht. Ich bin nicht so gut in der Programmierung, also bin ich mir nicht sicher, was das Problem ist. Es wäre schön, wenn mir jemand helfen könnte. Vielen Dank. :)

+1

ersetzen ';' 'durch:' 'nach def update()' ^^ – Arount

+1

Und bitte Ihren Einzug fixiert. –

+0

Ihr Titel ist extrem irreführend. '...' kann tatsächlich in einer import-Anweisung verwendet werden, wenn Ihre Pakete tief genug verschachtelt sind. Bitte repariere es. –

Antwort

0

Zuerst sollten Sie def update(): anstelle von def update(); verwenden. Zweitens Sie vermissen Einzüge

from PySide import QtCore 

i = 0 
def update(): 
    global i 
    App.getDocument("Unnamed2").Pad001.Placement=App.Placement(App.Vector(0,127.5,0), App.Rotation(App.Vector(0,0,1),-i), App.Vector(0,0,0)) 
    App.getDocument("Unnamed2").Pad.Placement=App.Placement(App.Vector(0,0,0), App.Rotation(App.Vector(0,0,1),i*(74.0/28.0)), App.Vector(0,0,0)) 
    i += 0.01 

timer = QtCore.QTimer() 
timer.timeout.connect(update) 
timer.start(1) 
Verwandte Themen