Jump to content

[Python]Window doesn't close


Recommended Posts

Hi all,

 

i'm following this tutorial: http://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/2462221-release-demon-tower-gui.html

 

to learn a little bit about python, but i'm having problem with the window, it doesn't close when i click on the close button.

 

this is the quest i'm using to test:

quest window begin
    state start begin
        when 20351.chat."show window" begin
            cmdchat("showDtTimer")
            setskin(NOWINDOW)
            return
        end
    end
end

I already have tried to close with this code on the uitd.py file:

	def Close(self):
		self.ClearDictionary()
		self.__Load_LoadScript.KillFocus()
		self.__Load_BindObject.KillFocus()
		self.Hide()
		return TRUE
		
	def __OnCloseButtonClick(self):
		self.ClearDictionary()
		self.__Load_LoadScript.KillFocus()
		self.__Load_BindObject.KillFocus()
		self.Hide()
		return TRUE
  • Metin2 Dev 1
  • Good 1
Link to comment
Share on other sites

uidt.py: 

import ui
import snd
import systemSetting
import net
import chat
import app
import locale
import chrmgr
import uiWhisper
import interfacemodule
import time
import wndMgr

class DemonTowerDialog(ui.ScriptWindow):

	def __init__(self):
		ui.ScriptWindow.__init__(self)
		self.eventClose = None
		self.__Load()
		
	def __del__(self):
		ui.ScriptWindow.__del__(self)

	def Destroy(self):
		self.Hide()
		return TRUE
		
	def __Load_LoadScript(self, fileName):
		try:
			pyScriptLoader = ui.PythonScriptLoader()
			pyScriptLoader.LoadScriptFile(self, fileName)
		except:
			import exception
			exception.Abort("DemonTowerDialog.__Load_LoadScript")

	def __Load_BindObject(self):
		try:
			self.board = self.GetChild("titlebar")
			self.timer = self.GetChild("timer")
			self.img = self.GetChild("img")
			self.counter = self.GetChild("counter")
			self.counter2 = self.GetChild("counter2")
			self.counter3 = self.GetChild("counter3")
			self.counter4 = self.GetChild("counter4")
			self.counter5 = self.GetChild("counter5")
		except:
			import exception
			exception.Abort("DemonTowerDialog.__Load_BindObject")
		
		self.board.SetCloseEvent(ui.__mem_func__(self.Close))

	def __Load(self):
		self.__Load_LoadScript("uiscript/dtboard.py")
		self.__Load_BindObject()
		width = wndMgr.GetScreenWidth()
		height = wndMgr.GetScreenHeight()
	
	def Show(self):
		ui.ScriptWindow.Show(self)
		
	def SetData(self,data):
		split = data.split('|')
		self.timer.SetText(str(split[0]))
		self.counter.SetText(str(split[1]))
		self.counter2.SetText(str(split[2]))
		self.counter3.SetText(str(split[3]))
		self.counter4.SetText(str(split[4]))
		self.counter5.SetText(str(split[5]))
	
	def SetCloseEvent(self, event):
		self.eventClose = event
		
	def Close(self):
		self.Hide()
		if self.eventClose:
			self.eventClose(self.vid)	
		return TRUE
		
	def OnPressEscapeKey(self):
		self.Hide()
		return TRUE
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.