#π How do i know where x and y positions are on a screen? (need to know for renpy)
38 messages Β· Page 1 of 1 (latest)
@versed flicker
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
.close
NOOOO
I was gonna help π
Oh hello xD
import tkinter as tk
# Create a root window
root = tk.Tk()
# Get screen dimensions
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
print(f"Screen width: {screen_width}")
print(f"Screen height: {screen_height}")
# Destroy the window as we only need the dimensions
root.destroy()
I thought it was useless to ask here I assumed no one does renpy
import pyautogui
# Get the screen size
screen_width, screen_height = pyautogui.size()
print(f"Screen width: {screen_width}")
print(f"Screen height: {screen_height}")
# Get the current position of the mouse
current_mouse_x, current_mouse_y = pyautogui.position()
print(f"Mouse position: ({current_mouse_x}, {current_mouse_y})")
import pygame
# Initialize pygame
pygame.init()
# Set up the screen
screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
# Get screen dimensions
screen_width = screen.get_width()
screen_height = screen.get_height()
print(f"Screen width: {screen_width}")
print(f"Screen height: {screen_height}")
# Main loop to test coordinates
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.MOUSEBUTTONDOWN:
x, y = pygame.mouse.get_pos()
print(f"Mouse clicked at: ({x}, {y})")
# Refresh the screen
pygame.display.flip()
# Quit pygame
pygame.quit()
tha6sb so cool! does this show where the mouse position is?
thank you so so much
3 options to pick from
i really appreciate it
yepp!
You are welcome
youre awesome
thank you bear
And never think its useless to ask around here! We always help even with the wierdest problems!
.close
You can also use an external program like MPos (for example) if you dont want to run a python script for some reason.
thank you! ill keep it in mind if python doesnt work
Also the command to close a thread is !close π
ohh yeah I was there for a bit
xD
yesyes
thank you guys
take care
no worries!!
bye
have a lovely day/night/evening/afternoon
weee
!close
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.