mirror of
https://github.com/1j01/textual-paint.git
synced 2024-12-27 16:52:40 +03:00
Get screen size with tkinter instead
screeninfo caused a bouncing python rocket in the dock on mac, and didn't work.
This commit is contained in:
parent
7f3fe53d3e
commit
eb0f781ca8
@ -224,6 +224,8 @@ GNOME Terminal works best, with crisp triangles used for icons in dialogs, emoji
|
|||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||
|
For **Set As Wallpaper**, it works better if you install tkinter, with `brew install python-tk`, so it can use your monitor's resolution. (This dependency could be removed in the future.)
|
||||||
|
|
||||||
Tested on OSX 10.14 (Mojave), with iTerm2, and VS Code's integrated terminal.
|
Tested on OSX 10.14 (Mojave), with iTerm2, and VS Code's integrated terminal.
|
||||||
|
|
||||||
iTerm2 mostly works, but two tool icons are missing (Free-Form Select and Fill With Color).
|
iTerm2 mostly works, but two tool icons are missing (Free-Form Select and Fill With Color).
|
||||||
|
@ -109,6 +109,7 @@
|
|||||||
"textconv",
|
"textconv",
|
||||||
"thumbnailer",
|
"thumbnailer",
|
||||||
"Thunar",
|
"Thunar",
|
||||||
|
"tkinter",
|
||||||
"tlaplus",
|
"tlaplus",
|
||||||
"truecolor",
|
"truecolor",
|
||||||
"tspan",
|
"tspan",
|
||||||
|
@ -5,7 +5,6 @@ pyfiglet==0.8.post1
|
|||||||
# PyGObject==3.42.1 # gi.repository module, used for setting the wallpaper on gnome, unity, and cinnamon; optional, falls back to gsettings CLI
|
# PyGObject==3.42.1 # gi.repository module, used for setting the wallpaper on gnome, unity, and cinnamon; optional, falls back to gsettings CLI
|
||||||
pyperclip==1.8.2
|
pyperclip==1.8.2
|
||||||
pyxdg==0.28 # xdg module, used for wallpaper setting; optional, falls back to ~/.config
|
pyxdg==0.28 # xdg module, used for wallpaper setting; optional, falls back to ~/.config
|
||||||
screeninfo==0.8.1 # used for wallpaper setting
|
|
||||||
rich==13.3.5
|
rich==13.3.5
|
||||||
stransi==0.3.0
|
stransi==0.3.0
|
||||||
textual[dev]==0.27.0
|
textual[dev]==0.27.0
|
||||||
|
@ -3590,17 +3590,25 @@ Columns: {len(palette) // 2}
|
|||||||
def get_screen_size(self) -> tuple[int, int]:
|
def get_screen_size(self) -> tuple[int, int]:
|
||||||
"""Get the screen size."""
|
"""Get the screen size."""
|
||||||
# TODO: test DPI scaling
|
# TODO: test DPI scaling
|
||||||
from screeninfo import get_monitors
|
try:
|
||||||
largest_area = 0
|
# from screeninfo import get_monitors
|
||||||
largest_monitor = None
|
# largest_area = 0
|
||||||
for m in get_monitors():
|
# largest_monitor = None
|
||||||
area = m.width * m.height
|
# for m in get_monitors():
|
||||||
if area > largest_area:
|
# area = m.width * m.height
|
||||||
largest_area = area
|
# if area > largest_area:
|
||||||
largest_monitor = m
|
# largest_area = area
|
||||||
assert largest_monitor is not None, "No monitors found."
|
# largest_monitor = m
|
||||||
return largest_monitor.width, largest_monitor.height
|
# assert largest_monitor is not None, "No monitors found."
|
||||||
|
# return largest_monitor.width, largest_monitor.height
|
||||||
|
|
||||||
|
import tkinter
|
||||||
|
root = tkinter.Tk()
|
||||||
|
root.withdraw()
|
||||||
|
return root.winfo_screenwidth(), root.winfo_screenheight()
|
||||||
|
except Exception as e:
|
||||||
|
print("Failed to get screen size:", e)
|
||||||
|
return 1920, 1080
|
||||||
|
|
||||||
def action_recent_file(self) -> None:
|
def action_recent_file(self) -> None:
|
||||||
self.message_box(_("Paint"), "Not implemented.", "ok")
|
self.message_box(_("Paint"), "Not implemented.", "ok")
|
||||||
|
Loading…
Reference in New Issue
Block a user