Python developer _ tkinter _ move the image with the mouse

Source: Internet
Author: User

This is inspired by a js effect:

Two eyes move with the mouse

  tkinter  *       = { :                 :                 :                :                 :                               self.draw = Canvas(self, width=500, height=500                   self.mouse_x = 450         self.mouse_y = 250                           self.oval_zero_x = 250         self.oval_zero_y = 250                  self.oval_r = 100                           self.oval_R = 30          self.oval_r1 = self.oval_r - self.oval_R + 0.5         self.oval_r2 = self.oval_r - self.oval_R - 0.5                    self.letter_ball_x1 = 250         self.letter_ball_y1 = 250                                   self.ball = self.draw.create_oval((self.oval_zero_x -                                           (self.oval_zero_y -                                           (self.oval_zero_x +                                           (self.oval_zero_y +                                           fill=          self.ball = self.draw.create_oval((self.oval_zero_x -                                           (self.oval_zero_y -                                           (self.oval_zero_x +                                           (self.oval_zero_y +                                           fill=          self.ball = self.draw.create_oval((self.oval_zero_x -                                           (self.oval_zero_y -                                           (self.oval_zero_x +                                           (self.oval_zero_y +                                           fill=                           self.ball_over = self.draw.create_oval((self.oval_zero_x -                                                (self.oval_zero_y -                                                (self.oval_zero_x +                                                (self.oval_zero_y +                                                fill=          self.draw.pack(side=               self.mouse_x =         self.mouse_y =                       ( * 50             (             (                  ax_x = abs(self.mouse_x -         ax_y = abs(self.mouse_y -                      (             (         ax_len = ((ax_x ** 2) + (ax_y ** 2))**0.5                      (                                ax_len > abs(self.oval_r -             ac_len = abs(self.oval_r -                              (                       int(self.mouse_x - self.oval_zero_x) !=                  int(self.mouse_y - self.oval_zero_y) !=                                          k = (self.mouse_y - self.oval_zero_y)/(self.mouse_x -                                              (                     b = self.mouse_y - (k *                                                                                                                                                                                                              letter_ball_x2 = ((ac_len * (abs(self.mouse_x - self.oval_zero_x)))/ax_len) +                     letter_ball_y2 = (letter_ball_x2 * k) +                                              (                         (                                           self.moved_x2 = letter_ball_x2 -                     self.moved_y2 = letter_ball_y2 -                                              (                      self.letter_ball_x1 =                     self.letter_ball_y1 =                                      (                              (                                       (                          letter_ball_x2 =             letter_ball_y2 =                              (                           self.moved_x2 = letter_ball_x2 -             self.moved_y2 = letter_ball_y2 -                              (              self.letter_ball_x1 =             self.letter_ball_y1 =           move_ball(self, *                                    self.draw.tag_bind(self.ball,        (self, master=                  letter_ball_x2 =                  letter_ball_y2 =                  SHOW_LOG =                  Frame.           self.after(10  game =  game.mainloop()

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.