Closed Sahil-pixel closed 4 months ago
Attach minimal code
button taking touch from wrong place . please run code and press button
from kivy.lang import Builder
from kivy.uix.behaviors import ButtonBehavior
from kivymd.app import MDApp
from kivymd.uix.behaviors import RotateBehavior
from kivymd.uix.boxlayout import MDBoxLayout
KV = '''
MDScreen:
md_bg_color: app.theme_cls.surfaceColor
RotateBox:
size_hint: .5, .5
pos_hint: {"center_x": .5, "center_y": .5}
#on_release: app.change_rotate(self)
md_bg_color: "red"
rotate_value_angle:180
MDButton:
style: "elevated"
#pos_hint: {"center_x": .5, "center_y": .5}
on_press:print(self,1)
MDButtonText:
text: "Elevated"
'''
class RotateBox(RotateBehavior, MDBoxLayout,):
pass
class Test(MDApp):
def build(self):
return Builder.load_string(KV)
def change_rotate(self, instance_button: RotateBox) -> None:
Animation(rotate_value_angle=45, d=0.3).start(instance_button)
Test().run()
Obviously it's expected, touch is detected when touch.pos collides with widget size and postion. But rotation is just like an "effect" which does not change the position of widget.
If you really want this kind of behaviour, make your own button class, then set postion yourself and rotate the label only.
Same can be done without kivymd, with just simple kivy
Closing as it's not kivymd related issue.
Description of the Bug
i have custom widget contain 4 button in a boxlayout and i want rotate 180 degree but button press not taking from right widget .
please see video and pointer to press button
Code and Logs