Python Forum
tkinter touchscreen scrolling - button press makes unwanted scrolling
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter touchscreen scrolling - button press makes unwanted scrolling
#2
Ok, I entirely commented out the on_press function and it seems to work fine.

Also I added some code to on_touch_scroll. Pushing the buttons now does not make the screen jump! But I cannot slowly scroll the screen, only can scroll with fast finger flicks now.

I guess I can live with that compromise (lost the ability to slow scroll). But there is another issue that persists - if my last touch was far from the newest touch, the screen will scroll a tiny amount towards the new touch. I would definitely like to know how to deactivate that effect.

 def on_touch_scroll(event):
            nowy = event.y_root
 
            sectionmoved = 11             # speed of scroll
            if nowy > (self.prevy + 20):    # to limit the minimum threshold to scroll
                event.delta = -sectionmoved
            elif nowy < (self.prevy - 20):  # to limit the minimum threshold to scroll
                event.delta = sectionmoved
            else:
                event.delta = 0
            self.prevy= nowy
 
            self.scrollposition += event.delta
            canvas.yview_moveto(self.scrollposition/ self.canvasheight)
Reply


Messages In This Thread
RE: tkinter touchscreen scrolling - button press makes unwanted scrolling - by nanok66 - Dec-28-2020, 10:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] TKinter Remove Button Frame Nu2Python 8 1,018 Jan-16-2024, 06:44 PM
Last Post: rob101
  tkinter - touchscreen, push the button like click the mouse John64 5 871 Jan-06-2024, 03:45 PM
Last Post: deanhystad
  Centering and adding a push button to a grid window, TKinter Edward_ 15 4,874 May-25-2023, 07:37 PM
Last Post: deanhystad
  Can't get tkinter button to change color based on changes in data dford 4 3,438 Feb-13-2022, 01:57 PM
Last Post: dford
  [Kivy] Unwanted format carryover hammer 0 1,363 Jan-14-2022, 05:17 PM
Last Post: hammer
  Creating a function interrupt button tkinter AnotherSam 2 5,563 Oct-07-2021, 02:56 PM
Last Post: AnotherSam
  [Tkinter] Have tkinter button toggle on and off a continuously running function AnotherSam 5 5,033 Oct-01-2021, 05:00 PM
Last Post: Yoriz
  tkinter showing image in button rwahdan 3 5,652 Jun-16-2021, 06:08 AM
Last Post: Yoriz
  .get() invoke after a button nested press iddon5 5 3,294 Mar-29-2021, 03:55 AM
Last Post: deanhystad
  tkinter button image Nick_tkinter 4 4,075 Mar-04-2021, 11:33 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020