Untitled

 avatar
unknown
plain_text
5 months ago
1.0 kB
3
Indexable
    def animate_open(self):
        if self.current_width < self.target_width:
            self.current_width += 40
            # Added +2 to account for border width
            x_pos = self.target_width - self.current_width + 2
            self.place(relx=1, rely=0, x=x_pos, y=0, anchor='ne')
            self.after(16, self.animate_open)
        else:
            self.current_width = self.target_width
            self.animation_running = False
 
    def animate_closed(self):
        if self.current_width > 0:
            self.current_width -= 40
            # Added +2 to account for border width
            x_pos = self.target_width - self.current_width + 2
            self.place(relx=1, rely=0, x=x_pos, y=0, anchor='ne')
            self.after(16, self.animate_closed)
        else:
            self.current_width = 0
            self.animation_running = False
            # Added +2 to account for border width
            self.place(relx=1, rely=0, x=self.target_width + 2, y=0, anchor='ne')
Editor is loading...
Leave a Comment