rotate a drawing object

86 views
Skip to first unread message

Degenerate Tech

unread,
Nov 22, 2020, 1:46:11 PM11/22/20
to Kivy users support
i have a rectangle i want to rotate by 90 degree ..how to do in pure python

Elliot Garbus

unread,
Nov 22, 2020, 2:43:48 PM11/22/20
to kivy-...@googlegroups.com

Have you tried converting the example to use python rather than kv?

 

https://kivy.org/doc/stable/examples/gen__canvas__rotation__py.html

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/f3e12c5f-8f71-4bc9-9873-b4b1866ee198n%40googlegroups.com.

 

Degenerate Tech

unread,
Nov 22, 2020, 2:49:15 PM11/22/20
to Kivy users support
sir i want to rotate 3 Rectangle objects with different angle ..i dont want to rotate Canvas object 


On Monday, November 23, 2020 at 1:13:48 AM UTC+5:30, ElliotG wrote:

Have you tried converting the example to use python rather than kv?

 

https://kivy.org/doc/stable/examples/gen__canvas__rotation__py.html

 

 

From: Degenerate Tech
Sent: Sunday, November 22, 2020 11:46 AM
To: Kivy users support
Subject: [kivy-users] rotate a drawing object

 

i have a rectangle i want to rotate by 90 degree ..how to do in pure python

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.

To unsubscribe from this group and stop receiving emails from it, send an email to kivy-...@googlegroups.com.

planckp...@gmail.com

unread,
Nov 22, 2020, 3:00:31 PM11/22/20
to Kivy users support
Remember the trigonometry class at school?  Use sin() and cos() to recalculate the position of each of corners of the rectangle.

Elliot Garbus

unread,
Nov 22, 2020, 3:09:16 PM11/22/20
to kivy-...@googlegroups.com

It is not clear what you are trying to do.

Any item drawn is ultimately a canvas object.

 

Other Options:

Use a Scatter Widget

Draw a rectangle using Line.points, and recalculate the x,y positions for the rotation.

To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/61866abc-1612-4fa6-8ffa-7e8a68e4fe7ao%40googlegroups.com.

 

planckp...@gmail.com

unread,
Nov 22, 2020, 3:45:35 PM11/22/20
to Kivy users support

Alexander Taylor

unread,
Nov 23, 2020, 8:26:09 AM11/23/20
to Kivy users support
If you want arbitrary rotations, use a Rotate canvas instruction.

If you specifically want to rotate by 90 degrees, just invert the aspect ratio as others have said.
Reply all
Reply to author
Forward
0 new messages