Jump to content
Forgot your email address? ×
×
×
  • Create New...
  • 0

Slide function


CastielL

Question

4 answers to this question

Recommended Posts

  • 0
import ui 

movement = 0 
startness = 0 

class movement_test(ui.ThinBoard): 
    def __init__(self): 
        ui.ThinBoard.__init__(self) 
        self.Loadmovement_test() 
         
    def __del__(self): 
        ui.ThinBoard.__del__(self) 

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

    def Loadmovement_test(self): 
        self.SetPosition(-250,120) 
        self.SetSize(300, 300) 
        self.Show() 
        self.AddFlag("movable") 
        self.AddFlag("float") 
        self.LoadButtons() 
     
    def LoadButtons(self): 
        self.down_button = ui.Button() 
        self.down_button.SetParent(self) 
        self.down_button.SetPosition(285, 150) 
        self.down_button.SetUpVisual("d:/ymir work/ui/public/Large_Button_01.sub") 
        self.down_button.SetOverVisual("d:/ymir work/ui/public/Large_Button_02.sub") 
        self.down_button.SetDownVisual("d:/ymir work/ui/public/Large_Button_03.sub") 
        self.down_button.SetText("Abrir") 
        self.down_button.SetEvent(ui.__mem_func__(self.start)) 
        self.down_button.Show() 
         
        self.up_button = ui.Button() 
        self.up_button.SetParent(self) 
        self.up_button.SetPosition(285, 150)
        self.up_button.SetUpVisual("d:/ymir work/ui/public/Large_Button_01.sub") 
        self.up_button.SetOverVisual("d:/ymir work/ui/public/Large_Button_02.sub") 
        self.up_button.SetDownVisual("d:/ymir work/ui/public/Large_Button_03.sub") 
        self.up_button.SetText("Cerrar") 
        self.up_button.SetEvent(ui.__mem_func__(self.end)) 
        self.up_button.Hide() 
         
    def start(self): 
        global startness 
        startness = 1 
        self.up_button.Show() 
        self.down_button.Hide() 

    def end(self): 
        global startness 
        startness = 2 
        self.up_button.Hide() 
        self.down_button.Show() 

    def OnUpdate(self): 
        global startness 
        global movement 
        if movement < 250 and startness == 1:  # Movement <250, ponemos el ancho de la board
            movement += 4 # Velocidad de movimiento
            self.SetPosition(-250+movement,120) 
        elif not movement < 250 and startness == 1:  # -250 posiion normal , 250 posicion abierto
            startness = 0 
        elif movement > 0 and startness == 2: 
            movement -= 4 # Velocidad de movimiento
            self.SetPosition(-250+movement,120) 
        elif not movement > 0 and startness == 2: 
            startness = 0 

    def Show(self): 
        ui.ThinBoard.Show(self) 

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

aaaa= movement_test() 
aaaa.Show()  

try it. have fun

  • Love 2
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • -15% Discount in Metin2 Dev Store (01/10/2021 => 31/12/2021) => Code => 15_PCT_OCT_TO_DEC_2021


  • Read our Rules
  • Activity

    1. 1

      Halloween 2021 Ninja M V2

    2. 0

      Visual Studio 2010 Ultimate

    3. 1

      Reduce server memory usage

    4. 31

      Metin2 Project - How to create à Metin2 private server on virtual machine

  • Recently Browsing

    • No registered users viewing this page.

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.