Python Timer

12/06/2014 20:37 rollback#1
Ich möchte mir in die Restart.py einen Timer einfügen, dass unter dem Stadt neu Starten Knopf die Zeit angezeigt wird, bis man in die Stadt teleportiert wird.

Kann mir da jemand weiterhelfen? Bin in Python bei einem Wissensstand von vllt 1-2% x.x
12/06/2014 20:48 MrDami123#2
Wie sieht die 'restart.py' aus? Und kannst du ggf. etwas genauer formulieren, was du genau erreichen möchtest, dass wäre wichtig um den Computer in Form der Programmiersprache die Anweisungen richtig zu übergeben.

Code:
import time

start = time.time()

location = 'dungeon'
while location != 'town':
    now = time.time()
    counter = now-start

    if counter >= 30:
        location = 'town'
    print(counter)
Das wäre ein einfacher Counter. Der bei 30 Sekunden abbricht indem er die Location ändert.
12/06/2014 21:49 rollback#3
uirestart.py:
PHP Code:
import dbg
import app
import net

import ui

###################################################################################################
## Restart
class RestartDialog(ui.ScriptWindow):

    
def __init__(self):
        
ui.ScriptWindow.__init__(self)

    
def __del__(self):
        
ui.ScriptWindow.__del__(self)

    
def LoadDialog(self):
        try:
            
pyScrLoader ui.PythonScriptLoader()
            
pyScrLoader.LoadScriptFile(self"uiscript/restartdialog.py")
        
except Exceptionmsg:
            (
typemsgtb)=sys.exc_info()
            
dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (typemsg))
            
app.Abort()
            return 
0

        
try:
            
self.restartHereButton=self.GetChild("restart_here_button")
            
self.restartTownButton=self.GetChild("restart_town_button")
        
except:
            
import sys
            
(typemsgtb)=sys.exc_info()
            
dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (typemsg))
            
app.Abort()
            return 
0

        self
.restartHereButton.SetEvent(ui.__mem_func__(self.RestartHere))
        
self.restartTownButton.SetEvent(ui.__mem_func__(self.RestartTown))

        return 
1

    def Destroy
(self):
        
self.restartHereButton=0
        self
.restartTownButton=0
        self
.ClearDictionary()

    
def OpenDialog(self):
        
self.Show()

    
def Close(self):
        
self.Hide()
        return 
TRUE

    def RestartHere
(self):
        
net.SendChatPacket("/restart_here")

    
def RestartTown(self):
        
import accept
        self
.testdialog accept.testdialog()
        
self.testdialog.Show()

    
def OnPressExitKey(self):
        return 
TRUE

    def OnPressEscapeKey
(self):
        return 
TRUE 
Ich möchte, dass wenn der Spieler stirbt, unter dem Stadt neu starten Button (oder in dem Text z.B. "In der Stadt neu starten (02:59)") ein Timer angezeigt wird der 3min runterzählt.
12/07/2014 19:08 MrDami123#4
Code:
self.restartHereButton.SetEvent(ui.__mem_func__(self.RestartHere))
self.restartTownButton.SetEvent(ui.__mem_func__(self.RestartTown))

    def RestartHere(self):
        net.SendChatPacket("/restart_here")

    def RestartTown(self):
        import accept
        self.testdialog = accept.testdialog()
        self.testdialog.Show()
Ist den bereits ein Delay vorhanden, nachdem man stirbt oder werden die Optionen 'Hier' und 'Stadt' direkt anklickbar angezeigt?
Wenn nicht, solltest du meines Wissens nach testen, ob die Änderung der z.B. Textpassage aus RestartTown auch im Spiel funktioniert.
Dafür musst du dir accept.testdialog() anschauen und einen mit deinem gewünschten Text erstellen.
12/07/2014 20:58 noahrmal#5
-> [Only registered and activated users can see links. Click Here To Register...]

So ein Timer ist dort eingebaut.
12/07/2014 21:00 DasSchwarzeT#6
Also Timer kannst du generell so machen:

Code:
		if self.AboutWindow:
			if self.AboutWindow.x_counter > 1:
				self.AboutWindow.x_counter -=1
				self.AboutWindow.text6.SetText("Zeit: %0.1f" % (self.AboutWindow.x_counter/45.0))
			elif self.AboutWindow.x_counter == 1:
				self.AboutWindow.Hide()
				# self.AboutWindow.Delete()
(entnommen aus dem Mijago Switchbot)
-> in die OnUpdate natürlich
12/07/2014 21:35 Poccix#7
[Only registered and activated users can see links. Click Here To Register...]
So würde es gehen.
[Only registered and activated users can see links. Click Here To Register...]
12/08/2014 00:04 rollback#8
danke leute ihr seid spitze!

kleines aber feines feature das meiner meinung nach ein muss für jeden server ist! :)

Code:
1208 21:19:06307 :: 
networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:28) ?
system.py(line:130) __pack_import
system.py(line:110) _process_result
interfaceModule.py(line:26) ?
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - exceptions.IndentationError:expected an indented block (line 124)

1208 21:19:06307 :: ============================================================================================================
1208 21:19:06307 :: Abort!!!!
Code:
import dbg
import app
import net
import time
import ui
 
###################################################################################################
## Restart
class RestartDialog(ui.ScriptWindow):
	Minutes = 2
	Seconds = 60
	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.Show()
		self.delaytimer = WaitingDialog()
		self.delaytimer2 = WaitingDialog()
 
	def __del__(self):
		ui.ScriptWindow.__del__(self)
 
	def LoadDialog(self):
		try:
			pyScrLoader = ui.PythonScriptLoader()
			pyScrLoader.LoadScriptFile(self, "uiscript/restartdialog.py")
		except Exception, msg:
			import sys
			(type, msg, tb)=sys.exc_info()
			dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
			app.Abort()
			return 0
 
		try:
			self.restartHereButton=self.GetChild("restart_here_button")
			self.restartTownButton=self.GetChild("restart_town_button")
			self.TimeString=self.GetChild("TimeString")
 
		except:
			import sys
			(type, msg, tb)=sys.exc_info()
			dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
			app.Abort()
			return 0
 
		self.restartHereButton.SetEvent(ui.__mem_func__(self.RestartHere))
		self.restartTownButton.SetEvent(ui.__mem_func__(self.RestartTown))
		return 1
 
	def LoadTimer(self):
		self.delaytimer.Open(1.0)
		if self.Minutes == 2:
			if self.Seconds <= 60 and self.Seconds >=1:
				if self.Seconds <= 10 and self.Seconds >= 0:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend " + str(self.Minutes) + ":0" + str(self.Seconds) + "min")
				else:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend " + str(self.Minutes) + ":" + str(self.Seconds) + "min")
			if self.Seconds == 0:
				self.TimeString.SetText("Verbleibend " + str(self.Minutes) + ":0" + str(self.Seconds) + "min")
		if self.Minutes == 1:
			if self.Seconds <= 60 and self.Seconds >=1:
				if self.Seconds <= 10 and self.Seconds >= 0:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend " + str(self.Minutes) + ":0" + str(self.Seconds) + "min")
				else:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend " + str(self.Minutes) + ":" + str(self.Seconds) + "min")
			if self.Seconds == 0:
				self.TimeString.SetText("Verbleibend " + str(self.Minutes) + ":0" + str(self.Seconds) + "min")
		if self.Minutes == 0:
			if self.Seconds <= 60 and self.Seconds >=1:
				if self.Seconds <= 10 and self.Seconds >= 0:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend " + str(self.Minutes) + ":0" + str(self.Seconds) + "min")
				else:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend " + str(self.Minutes) + ":" + str(self.Seconds) + "min")
			if self.Seconds == 0:
				self.TimeString.SetText("Verbleibend " + str(self.Minutes) + ":0" + str(self.Seconds) + "min")
		if self.Seconds == 0 and self.Minutes == 2:
			self.Minutes = 1
			self.Seconds = 60
		if self.Seconds == 0 and self.Minutes == 1:
			self.Minutes = 0
			self.Seconds = 60
		if self.Seconds == 0 and self.Minutes == 0:
			self.Minutes = 2
			self.Seconds = 60
		self.delaytimer.SAFE_SetTimeOverEvent(self.LoadTimer)
		       
	def Destroy(self):
		self.restartHereButton=0
		self.restartTownButton=0
		self.ClearDictionary()
 
	def OpenDialog(self):
		self.Show()
		self.delaytimer.Open(1.0)
		self.LoadTimer()
 
	def Close(self):
		self.Hide()
		self.delaytimer.Open(99999999999999.0)
		self.Minutes = 2
		self.Seconds = 60
		return True
 
	def RestartHere(self):
		net.SendChatPacket("/restart_here")
 
	def RestartTown(self):
		import accept
		self.testdialog = accept.testdialog()
		self.testdialog.Show()
 
	def OnPressExitKey(self):
		return True
 
	def OnPressEscapeKey(self):
		return True
 
class WaitingDialog(ui.ScriptWindow):
		def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.eventTimeOver = lambda *arg: None
		self.eventExit = lambda *arg: None
 
	def __del__(self):
		ui.ScriptWindow.__del__(self)
 
	def Open(self, waitTime):
		curTime = time.clock()
		self.endTime = curTime + waitTime
		self.Show()	    
 
	def Close(self):
		self.Hide()
	       
	def Destroy(self):
		self.Hide()
 
	def SAFE_SetTimeOverEvent(self, event):
		self.eventTimeOver = ui.__mem_func__(event)
 
	def SAFE_SetExitEvent(self, event):
		self.eventExit = ui.__mem_func__(event)
       
	def OnUpdate(self):	    
		lastTime = max(0, self.endTime - time.clock())
		if 0 == lastTime:
			self.Close()
			self.eventTimeOver()
		else:
			return
			       
	def OnPressExitKey(self):
		self.Close()
		return TRUE
 
restartdialog.py
 
import uiScriptLocale
 
ROOT = "d:/ymir work/ui/public/"
 
window = {
	"name" : "RestartDialog",
	"style" : ("float",),
 
	"x" : 50,
	"y" : 50,
 
	"width" : 200,
	"height" : 100,
 
	"children" :
	(
		{
			"name" : "board",
			"type" : "thinboard",
 
			"x" : 0,
			"y" : 0,
 
			"width" : 200,
			"height" : 100,
 
			"r" : 0.3333,
			"g" : 0.2941,
			"b" : 0.2588,
			"a" : 1.0,
 
			"children" :
			(
				{
					"name" : "restart_here_button",
					"type" : "button",
 
					"x" : 10,
					"y" : 17,
 
					"text" : uiScriptLocale.RESTART_HERE,
 
					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "restart_town_button",
					"type" : "button",
 
					"x" : 10,
					"y" : 47,
 
					"text" : uiScriptLocale.RESTART_TOWN,
 
					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "TimeString",
					"type" : "text",
					"x" : 100,
					"y" : 80,
					"text_horizontal_align" : "center",
					"text" : "Debug-Time",
				},
			),
		},
	),
}
12/08/2014 22:10 .zRy#9
Gleicher Fehler -.-"
12/08/2014 22:11 DasSchwarzeT#10
So schwer ist es doch nicht...
12/09/2014 00:01 Poccix#11
Das das 2 verschiedene Dateien sind ist euch bewusst oder ? In der Pastebin Datei :)
12/09/2014 05:08 rollback#12
Oops ... :D

Und was hab ich jetzt falsch gemacht ? ...

Code:
1209 19:00:07259 :: 
networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:28) ?
system.py(line:130) __pack_import
system.py(line:110) _process_result
interfaceModule.py(line:26) ?
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - exceptions.SyntaxError:invalid syntax (line 159)

1209 19:00:07259 :: ============================================================================================================
1209 19:00:07259 :: Abort!!!!
Code:
import dbg
import app
import net
import time
import ui
 
###################################################################################################
## Restart
class RestartDialog(ui.ScriptWindow):
	Minutes = 2
	Seconds = 60
	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.Show()
		self.delaytimer = WaitingDialog()
		self.delaytimer2 = WaitingDialog()
 
	def __del__(self):
		ui.ScriptWindow.__del__(self)
 
	def LoadDialog(self):
		try:
			pyScrLoader = ui.PythonScriptLoader()
			pyScrLoader.LoadScriptFile(self, "uiscript/restartdialog.py")
		except Exception, msg:
			import sys
			(type, msg, tb)=sys.exc_info()
			dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
			app.Abort()
			return 0
 
		try:
			self.restartHereButton=self.GetChild("restart_here_button")
			self.restartTownButton=self.GetChild("restart_town_button")
			self.TimeString=self.GetChild("TimeString")
 
		except:
			import sys
			(type, msg, tb)=sys.exc_info()
			dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
			app.Abort()
			return 0
 
		self.restartHereButton.SetEvent(ui.__mem_func__(self.RestartHere))
		self.restartTownButton.SetEvent(ui.__mem_func__(self.RestartTown))
		return 1
 
	def LoadTimer(self):
		self.delaytimer.Open(1.0)
		if self.Minutes == 2:
			if self.Seconds <= 60 and self.Seconds >=1:
				if self.Seconds <= 10 and self.Seconds >= 0:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
				else:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":" + str(self.Seconds) + " min")
			if self.Seconds == 0:
				self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
		if self.Minutes == 1:
			if self.Seconds <= 60 and self.Seconds >=1:
				if self.Seconds <= 10 and self.Seconds >= 0:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
				else:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":" + str(self.Seconds) + " min")
			if self.Seconds == 0:
				self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
		if self.Minutes == 0:
			if self.Seconds <= 60 and self.Seconds >=1:
				if self.Seconds <= 10 and self.Seconds >= 0:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
				else:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":" + str(self.Seconds) + " min")
			if self.Seconds == 0:
				self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
		if self.Seconds == 0 and self.Minutes == 2:
			self.Minutes = 1
			self.Seconds = 60
		if self.Seconds == 0 and self.Minutes == 1:
			self.Minutes = 0
			self.Seconds = 60
		if self.Seconds == 0 and self.Minutes == 0:
			self.Minutes = 2
			self.Seconds = 60
		self.delaytimer.SAFE_SetTimeOverEvent(self.LoadTimer)
			   
	def Destroy(self):
		self.restartHereButton=0
		self.restartTownButton=0
		self.ClearDictionary()
 
	def OpenDialog(self):
		self.Show()
		self.delaytimer.Open(1.0)
		self.LoadTimer()
 
	def Close(self):
		self.Hide()
		self.delaytimer.Open(99999999999999.0)
		self.Minutes = 2
		self.Seconds = 60
		return True
 
	def RestartHere(self):
		net.SendChatPacket("/restart_here")
 
	def RestartTown(self):
		import accept
		self.testdialog = accept.testdialog()
		self.testdialog.Show()
 
	def OnPressExitKey(self):
		return True
 
	def OnPressEscapeKey(self):
		return True
 
class WaitingDialog(ui.ScriptWindow):
	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.eventTimeOver = lambda *arg: None
		self.eventExit = lambda *arg: None
 
	def __del__(self):
		ui.ScriptWindow.__del__(self)
 
	def Open(self, waitTime):
		curTime = time.clock()
		self.endTime = curTime + waitTime
		self.Show()		
 
	def Close(self):
		self.Hide()
		   
	def Destroy(self):
		self.Hide()
 
	def SAFE_SetTimeOverEvent(self, event):
		self.eventTimeOver = ui.__mem_func__(event)
 
	def SAFE_SetExitEvent(self, event):
		self.eventExit = ui.__mem_func__(event)
	   
	def OnUpdate(self):		
		lastTime = max(0, self.endTime - time.clock())
		if 0 == lastTime:
			self.Close()
			self.eventTimeOver()
		else:
			return
				   
	def OnPressExitKey(self):
		self.Close()
		return TRUE
Code:
import uiScriptLocale
 
ROOT = "d:/ymir work/ui/public/"
 
window = {
	"name" : "RestartDialog",
	"style" : ("float",),
 
	"x" : 50,
	"y" : 50,
 
	"width" : 200,
	"height" : 100,
 
	"children" :
	(
		{
			"name" : "board",
			"type" : "thinboard",
 
			"x" : 0,
			"y" : 0,
 
			"width" : 200,
			"height" : 100,
 
			"r" : 0.3333,
			"g" : 0.2941,
			"b" : 0.2588,
			"a" : 1.0,
 
			"children" :
			(
				{
					"name" : "restart_here_button",
					"type" : "button",
 
					"x" : 10,
					"y" : 17,
 
					"text" : uiScriptLocale.RESTART_HERE,
 
					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "restart_town_button",
					"type" : "button",
 
					"x" : 10,
					"y" : 47,
 
					"text" : uiScriptLocale.RESTART_TOWN,
 
					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "TimeString",
					"type" : "text",
					"x" : 100,
					"y" : 80,
					"text_horizontal_align" : "center",
					"text" : "Debug-Time",
				},
			),
		},
	),
}
12/09/2014 21:24 DasSchwarzeT#13
Quote:
Originally Posted by [Sensenmann] View Post
Oops ... :D

Und was hab ich jetzt falsch gemacht ? ...

Code:
1209 19:00:07259 :: 
networkModule.py(line:194) SetSelectCharacterPhase
system.py(line:130) __pack_import
system.py(line:110) _process_result
introSelect.py(line:28) ?
system.py(line:130) __pack_import
system.py(line:110) _process_result
interfaceModule.py(line:26) ?
system.py(line:130) __pack_import

networkModule.SetSelectCharacterPhase - exceptions.SyntaxError:invalid syntax (line 159)

1209 19:00:07259 :: ============================================================================================================
1209 19:00:07259 :: Abort!!!!
Code:
import dbg
import app
import net
import time
import ui
 
###################################################################################################
## Restart
class RestartDialog(ui.ScriptWindow):
	Minutes = 2
	Seconds = 60
	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.Show()
		self.delaytimer = WaitingDialog()
		self.delaytimer2 = WaitingDialog()
 
	def __del__(self):
		ui.ScriptWindow.__del__(self)
 
	def LoadDialog(self):
		try:
			pyScrLoader = ui.PythonScriptLoader()
			pyScrLoader.LoadScriptFile(self, "uiscript/restartdialog.py")
		except Exception, msg:
			import sys
			(type, msg, tb)=sys.exc_info()
			dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
			app.Abort()
			return 0
 
		try:
			self.restartHereButton=self.GetChild("restart_here_button")
			self.restartTownButton=self.GetChild("restart_town_button")
			self.TimeString=self.GetChild("TimeString")
 
		except:
			import sys
			(type, msg, tb)=sys.exc_info()
			dbg.TraceError("RestartDialog.LoadDialog - %s:%s" % (type, msg))
			app.Abort()
			return 0
 
		self.restartHereButton.SetEvent(ui.__mem_func__(self.RestartHere))
		self.restartTownButton.SetEvent(ui.__mem_func__(self.RestartTown))
		return 1
 
	def LoadTimer(self):
		self.delaytimer.Open(1.0)
		if self.Minutes == 2:
			if self.Seconds <= 60 and self.Seconds >=1:
				if self.Seconds <= 10 and self.Seconds >= 0:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
				else:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":" + str(self.Seconds) + " min")
			if self.Seconds == 0:
				self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
		if self.Minutes == 1:
			if self.Seconds <= 60 and self.Seconds >=1:
				if self.Seconds <= 10 and self.Seconds >= 0:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
				else:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":" + str(self.Seconds) + " min")
			if self.Seconds == 0:
				self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
		if self.Minutes == 0:
			if self.Seconds <= 60 and self.Seconds >=1:
				if self.Seconds <= 10 and self.Seconds >= 0:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
				else:
					self.Seconds -= 1
					self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":" + str(self.Seconds) + " min")
			if self.Seconds == 0:
				self.TimeString.SetText("Verbleibend: " + str(self.Minutes) + ":0" + str(self.Seconds) + " min")
		if self.Seconds == 0 and self.Minutes == 2:
			self.Minutes = 1
			self.Seconds = 60
		if self.Seconds == 0 and self.Minutes == 1:
			self.Minutes = 0
			self.Seconds = 60
		if self.Seconds == 0 and self.Minutes == 0:
			self.Minutes = 2
			self.Seconds = 60
		self.delaytimer.SAFE_SetTimeOverEvent(self.LoadTimer)
			   
	def Destroy(self):
		self.restartHereButton=0
		self.restartTownButton=0
		self.ClearDictionary()
 
	def OpenDialog(self):
		self.Show()
		self.delaytimer.Open(1.0)
		self.LoadTimer()
 
	def Close(self):
		self.Hide()
		self.delaytimer.Open(99999999999999.0)
		self.Minutes = 2
		self.Seconds = 60
		return True
 
	def RestartHere(self):
		net.SendChatPacket("/restart_here")
 
	def RestartTown(self):
		import accept
		self.testdialog = accept.testdialog()
		self.testdialog.Show()
 
	def OnPressExitKey(self):
		return True
 
	def OnPressEscapeKey(self):
		return True
 
class WaitingDialog(ui.ScriptWindow):
	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.eventTimeOver = lambda *arg: None
		self.eventExit = lambda *arg: None
 
	def __del__(self):
		ui.ScriptWindow.__del__(self)
 
	def Open(self, waitTime):
		curTime = time.clock()
		self.endTime = curTime + waitTime
		self.Show()		
 
	def Close(self):
		self.Hide()
		   
	def Destroy(self):
		self.Hide()
 
	def SAFE_SetTimeOverEvent(self, event):
		self.eventTimeOver = ui.__mem_func__(event)
 
	def SAFE_SetExitEvent(self, event):
		self.eventExit = ui.__mem_func__(event)
	   
	def OnUpdate(self):		
		lastTime = max(0, self.endTime - time.clock())
		if 0 == lastTime:
			self.Close()
			self.eventTimeOver()
		else:
			return
				   
	def OnPressExitKey(self):
		self.Close()
		return TRUE
Code:
import uiScriptLocale
 
ROOT = "d:/ymir work/ui/public/"
 
window = {
	"name" : "RestartDialog",
	"style" : ("float",),
 
	"x" : 50,
	"y" : 50,
 
	"width" : 200,
	"height" : 100,
 
	"children" :
	(
		{
			"name" : "board",
			"type" : "thinboard",
 
			"x" : 0,
			"y" : 0,
 
			"width" : 200,
			"height" : 100,
 
			"r" : 0.3333,
			"g" : 0.2941,
			"b" : 0.2588,
			"a" : 1.0,
 
			"children" :
			(
				{
					"name" : "restart_here_button",
					"type" : "button",
 
					"x" : 10,
					"y" : 17,
 
					"text" : uiScriptLocale.RESTART_HERE,
 
					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "restart_town_button",
					"type" : "button",
 
					"x" : 10,
					"y" : 47,
 
					"text" : uiScriptLocale.RESTART_TOWN,
 
					"default_image" : ROOT + "XLarge_Button_01.sub",
					"over_image" : ROOT + "XLarge_Button_02.sub",
					"down_image" : ROOT + "XLarge_Button_03.sub",
				},
				{
					"name" : "TimeString",
					"type" : "text",
					"x" : 100,
					"y" : 80,
					"text_horizontal_align" : "center",
					"text" : "Debug-Time",
				},
			),
		},
	),
}
Adde mich in Skype ich helfe dir per Teamviewer
12/09/2014 21:30 rollback#14
Hat sich schon erledigt, aber trotzdem danke.

Ich hatte alles eigentlich alles richtig gemacht, als Poccix rübergeschaut hat hat er auch keinen Fehler finden können, hat es nochmal gepackt und eingefügt und schon ging es ...
Zum Glück nicht nur beim Vorfüreffekt sondern auch bleiben ...^^