On May 15, 2022, at 5:18 AM, coutinh...@gmail.com <coutinh...@gmail.com> wrote:
Hello friends.
--
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/c8bd4023-e806-4925-8a79-79ac0f480f34n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/FAC296E3-5EA7-4D3F-91E3-2021D93E7A53%40cox.net.
If the problem is you do not want to snackbar to be opened the first time the screen is entered, you can add a variable to track that. See the example below.
class ScreenRecycleView(Screen):
image_data = ListProperty()
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.first_view = True
def on_kv_post(self, base_widget):
self.ids.rv.data = [
{
'source': choice(sample_images),
'text': ''.join(sample(ascii_lowercase, 6))
}
for x in range(50)
]
def on_enter(self):
if self.first_view:
self.first_view = False
else:
Snackbar(text='Após a pesquisa clique 2x na imagem.').open()
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CALgom8pjwREj8%3D75qxER-Ev%2Bz7nyf9t3m%3DHw0Lt%2BhrPx9Knm%2BQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/62826323.1c69fb81.6cc1b.45baSMTPIN_ADDED_MISSING%40gmr-mx.google.com.
I did not see this behavior.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CALgom8q1y7B6dXZRxLxGmQGT5MetSLi6tPCtdbce913M6Q2BLw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/628462e5.1c69fb81.2eed4.3d20SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
The on_enter event is firing in your nested screen manager, causing the snackbar to show up. The snackbar is not attached to the screen so is displayed on the current screen. Here is a possible workaround.
Add a screen to the nested screen_manager as a place holder. This way the ScreenRecycleView will not be entered by default.
ScreenManager:
id: screen_manager
Screen: # placeholder so ScreenRecycleView is not opened by default
ScreenRecycleView:
TelaLogin:
TelaItem:
Then in your primary screen_manager, change to the ‘screen_listagem’ when entering the main screen.
ScreenManager:
id: screen_manager_login
TelaLogin:
name: 'tela_login'
MainScreen:
name: 'main_screen'
on_enter: self.ids.screen_manager.current = 'screen_listagem'
'''
This should fix the behavior of the SnackBar.
Things might be simpler if you did not nest your ScreenManagers. They are both taking the full screen – so I don’t understand the utility of nesting them.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CALgom8oPj7xXyLdZt7SOfHfaSENPWCpWJNfgv9CwhfCo8KjJGQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/62855f56.1c69fb81.2004e.9b55SMTPIN_ADDED_MISSING%40gmr-mx.google.com.
On May 20, 2022, at 3:32 PM, Elias Coutinho <coutinh...@gmail.com> wrote:
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/CALgom8r8sM7kNWxUKH%3D%3DdLGhyyGT%2BsK1UXORKWsAGNUV%2BxPrag%40mail.gmail.com.