Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scrolling in Python
#1
Hi I am new to python. Can anyone help me. I am writing a small program in which I need to scroll up or down in order to find a button and then it will open up a sub window and then I need to perform a series of click then close the sub window, then move on to the next button then perform the same series of clicks.

This is the python I wrote I don't know how to add the scrolling function into it. Anyone can help?

This is the code:
https://paste.pythondiscord.com/UJ3Q

Thanks!
Larz60+ write Nov-24-2023, 10:37 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button
Reply
#2
I remember putting a scrollbar in a text frame, frame2, within a window, so I could scroll up and down in the text as the output grew. That looked like this:

vsb = tk.Scrollbar(frame2, orient="vertical", command=text_area.yview)
vsb.grid(row=0, column=1, sticky='ns')
text_area.configure(yscrollcommand=vsb.set)
But if you search tkinter scrollbar, I'm sure you'll find what you want!
Reply
#3
(Nov-23-2023, 07:02 AM)Pedroski55 Wrote: I remember putting a scrollbar in a text frame, frame2, within a window, so I could scroll up and down in the text as the output grew. That looked like this:

vsb = tk.Scrollbar(frame2, orient="vertical", command=text_area.yview)
vsb.grid(row=0, column=1, sticky='ns')
text_area.configure(yscrollcommand=vsb.set)
But if you search tkinter scrollbar, I'm sure you'll find what you want!
I answered in the following post it is clearer in terms of what is needed. There is already a subwindow and I can't scroll it. (The subwindow is inside the program I want to scroll.)
Reply
#4
Btw let me explain a bit. I am using a program called Cubase. it is a music program. So the full function I would need is:

Main program window:
Find TSTR.jpg Track
Click on it (all the click means left button mouse click)

Find TVEP.jpg Button
Click on it

Find TConnect.jpg Button
Click on it

SUBWINDOW
(Here it opens up a subwindow in Cubase and here is the tricky part where there is a need for scrolling, so I thought if I make Python click on the first item on the list and use scroll function until
it finds the track I need, it would work but here is where it does not work anymore)

Find VEPBell.jpg First track within the sub window
Click on it

Scroll down until it finds VEPSectStr.jpg track

Find VEPConnect.jpg button
Click on it

Find VEPAll.jpg button
Click on it

Find VEPClose.jpg button
Click on it
(Then this returns to the main program window and it needs to find the next track)

Main program window:
Scroll down until it finds TMSS.jpg Track
And click on it

Find TVEP.jpg button
Click on it

Find TConnect.jpg Button
Click on it

Subwindow
Find VEPBell.jpg track (VEPBell is the first one on the list of the subwindow)
Click on it

Scroll down until it finds VEPMSS.jpg Track

Find VEPConnect.jpg Button
Click on it

Find VEPAll.jpg Button
Click on it

Find VEPClose.jpg Button
Click on it


That's what I need if you could help me figure out. Thank you! and Happy thanksgiving.
Reply
#5
Youre python program uses something like pyautogui to run a program named Cubase. Is that correct? Next time post code so there is no guessing involved.
Reply
#6
Hi I thought I posted a link to the code. But here it is again. I actaully found out where the issue is but still not able to solve it. I want to click on the TSectStr.PNG but it is hidden inside a drop down menu. For some reason python is not able to see this dropdown menu thus it can't click on it.

Is there anyway that python is able to locate and see the dropdown menu images?

Thanks

from imagesearch import imagesearch
from pynput.mouse import Button, Controller
import time
import pyautogui
import time
import os
os.chdir('C:\\Users\\ARCLA\\AppData\\Local\\Programs\\Python\\Python312\\auto_click')


pyautogui.moveTo(2000, 1500)
pyautogui.click()

pyautogui.hotkey('y')

pyautogui.write('Violin I A STR VEP')

pyautogui.hotkey('enter')

print('Looking for "TSectStr.PNG" button...')
x, y = imagesearch("TSectStr.PNG", 0.8)
if x != -1 and y != -1:
    print('Button "TSectStr.PNG" found, clicking...')
    pyautogui.moveTo(x+10,y+10)
    pyautogui.click(button="left")
Reply
#7
If I can make python see the images in this drop down menu then I will be able to solve all the other issues.

I tested it with just a screen shot of the drop down menu. Python was able to locate the image (button) and click on the screen shot dropdown menu in Paint. It is not able to locate and see it when it is inside the program Cubase after typing the hot key "y" to make the drop down menu show up then python is stuck and unable to see it.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  help with scrolling text on RGB Matrix Foutsy 3 309 Apr-09-2024, 09:00 PM
Last Post: deanhystad
  raspberry use scrolling text two lines together fishbone 0 1,464 Sep-06-2021, 03:24 AM
Last Post: fishbone
  Can Python be used to create scrolling credits (as follows) digger 3 2,949 Aug-27-2021, 03:15 PM
Last Post: Larz60+
  How to scrolling Picture in x axis kalihotname 1 2,265 Jun-16-2020, 12:18 PM
Last Post: DeaD_EyE
  scrolling a text using loop ebolisa 1 3,297 Apr-27-2019, 02:31 PM
Last Post: ebolisa
  20 x 4 Line 2 scrolling text for LCD-I2C Display RoadieMunky 2 4,797 Mar-04-2018, 10:17 AM
Last Post: RoadieMunky

Forum Jump:

User Panel Messages

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