Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'tk'
- $point_A = [0,0]
- $point_B = [500,500]
- $rate = 1.5
- def before_drawing()
- $point_A = []
- temp_a = $point_B[0] / $rate
- temp_b = $point_B[1] / $rate
- $point_A << $point_B[0] - temp_a
- $point_A << $point_B[1] - temp_b
- end
- def after_drawing()
- $point_B = []
- $point_B << $point_A.[0]
- $point_B << $point_A.[1]
- end
- canvas = TkCanvas.new(:width=>750, :height=>750).pack('fill' => 'both', 'expand'=>true)
- rect_1 = TkcRectangle.new(canvas, $point_A, $point_B)
- before_drawing()
- rect_2 = TkcRectangle.new(canvas, $point_A, $point_B)
- after_drawing()
- before_drawing()
- rect_3 = TkcRectangle.new(canvas, $point_A, $point_B)
- after_drawing()
- before_drawing()
- rect_4 = TkcRectangle.new(canvas, $point_A, $point_B)
- after_drawing()
- before_drawing()
- rect_5 = TkcRectangle.new(canvas, $point_A, $point_B)
- Tk.mainloop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement