--
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/54093d4a-23ff-445c-a744-d89196105d77n%40googlegroups.com.
I created a separate class, TI to be your Input, and use the on_touch_down directly.
Touches get sent to all widgets. You want to use on_collide_point to test the touch.
It would perhaps be more appropriate to create a class that contains both the dropdown and the TextInput.
from kivy.uix.dropdown import DropDown
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
class TI(TextInput):
def on_touch_down(self, touch):
if self.collide_point(*touch.pos):
print('widget touched')
app = App.get_running_app()
app.dropdown.open(self)
class Test(App):
def build(self):
box = GridLayout(cols=3, rows=3)
label = Label(text='LABEL1')
label2 = Label(text='LABEL2')
label3 = Label(text='LABEL3'
)
ti = TI(text='Selection', font_size=30, size_hint_y=0.15)
# self.ti.bind(on_touch_down=self.list_open)
# self.ti.bind(on_touch_up= self.test_collide_list)
box.add_widget(label)
box.add_widget(label2)
box.add_widget(label3)
box.add_widget(ti)
self.dropdown = DropDown() # Create the dropdown once and keep a reference to it
self.dropdown.bind(on_select=lambda instance, x: setattr(ti, 'text', x))
# self.dropdown.text="drop"
for index in range(10): # create the buttons once
btn = Button(text='Value %d' % index, size_hint_y=None, height=44,
on_release=lambda btn: print(btn.text)) # bind every btn to a print statement
btn.text = 'Value %d' % index
btn.bind(on_release=lambda btn: self.dropdown.select(btn.text))
self.dropdown.add_widget(btn)
return box
def list_open(self, button, *args):
print("--------",button, args)
self.dropdown.open(button) # you need this to open the dropdown
def test_collide_list(self,*args):
print("INST ")
print("point ",*args[1].pos)
for x in args:
print("test", x)
for w in self.dropdown.walk():
print("Button" in str(w), *args[1].pos, w.collide_point(*args[1].pos), w.pos)
if "Button" in str(w) and w.collide_point(*args[1].pos):
print(w.text)
Test().run()
--
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/a4e2e9b3-f1c3-43d4-83da-9c63e1412e74n%40googlegroups.com.
I’m using kivy 2.0, the behavior you describe is not what I see.
When I click in the text box the dropdown opens. It remains open until an item is selected.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/46bdbfa8-ee7f-4263-ace0-bf1b1dabd12fn%40googlegroups.com.
I noticed I could not type in the box and made the fix below:
from kivy.uix.dropdown import DropDown
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
class TI(TextInput):
def on_touch_down(self, touch):
if self.collide_point(*touch.pos):
print('widget touched')
app = App.get_running_app()
app.dropdown.open(self
)
return super().on_touch_down(touch)
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/605653ad.1c69fb81.2ad7e.9c5dSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
On linux systems, the mouse provider can be annoying when used with another multitouch provider (hidinput or mtdev). The Mouse can conflict with them: a single touch can generate one event from the mouse provider and another from the multitouch provider.
To avoid this behavior, you can activate the “disable_on_activity” token in the mouse configuration. Then, if any touches are created by another provider, the mouse event will be discarded. Add this to your configuration:
I create a file I call configstartup.py and included it as the first import in the main.py file. It is imported before kivy.app
The resolution of the Icon for Windows and MacOS is different. The line with exit on escape, turns off the exit on escape capability, and the disable_mulitouch will stop the red dot on a right click.
#configstartup.py
from kivy.config import Config
from kivy.utils import platform
if platform == 'macosx':
Config.set('kivy', 'window_icon','Images/ME-APP-Design-Icon_512.png')
else:
Config.set('kivy', 'window_icon','Images/ME-APP-Design-Icon_64.png') # Windows uses a small png
Config.set('kivy', 'exit_on_escape', 0)
Config.set('input', 'mouse', 'mouse,disable_multitouch')
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/eb1c8941-6924-47d8-ba63-82c9429e8feen%40googlegroups.com.
On Mar 22, 2021, at 11:09 AM, sergen <2511...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/65979f7f-4f51-44eb-ad29-fcd724a95a61n%40googlegroups.com.
Share your code.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/924ba90b-4ed4-4280-8d8c-8a0c49ac20e5n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/3adf6e7b-f186-421c-805e-2db33ad481d2n%40googlegroups.com.
Try this:
from kivy.config import Config
Config.set('kivy', 'exit_on_escape', 0)
Config.set('input', 'mouse', 'mouse,disable_multitouch')
from kivy.uix.dropdown import DropDown
from kivy.uix.button import Button
from kivy.uix.textinput import TextInput
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
class TI(TextInput):
def on_touch_down(self
, touch):
if self.collide_point(*touch.pos) and touch.button == 'left':
print('widget touched')
app = App.get_running_app()
app.dropdown.open(self
)
return super().on_touch_down(touch)
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/3adf6e7b-f186-421c-805e-2db33ad481d2n%40googlegroups.com.