GithubHelp home page GithubHelp logo

python-xrectsel's Introduction

python-xrectsel

Geometry of a rectangular screen region

Python Versions Build Status PyPI version License: GPLV3 Code style: black

The project idea based on xrectsel. Its Python variant with some enhancements.

Installation:

pip install python-xrectsel

Usage:

❯ xrectsel --help
Usage: xrectsel [OPTIONS]

Options:
  -f, --format TEXT               Format output string with fallowing options:

                                  %x - start x-coordinate

                                  %y - start y-coordinate

                                  %X - start

                                  %Y - end

                                  %w - width

                                  %h - height

                                  Note: default output is in "%wx%h+%x+%y"
                                  format.

  -ci, --cursor-icon [crosshair|cross|pencil|dotbox]
                                  Select cursor icon
  -cf, --cursor-foreground <INTEGER INTEGER INTEGER>...
                                  Select cursor foreground color
  -cb, --cursor-background <INTEGER INTEGER INTEGER>...
                                  Select cursor background color
  -h, --help                      Show this message and exit.
  • We can collect selected region geometry just by command xrectsel. Default format is %wx%h+%x+%y
$ xrectsel
$ # select rectangle on sreen
901x634+44+7 #(x-coordinate, y-coordinate, width, height)
  • We can format output geometry string
$ xrectsel -f "--x=%x --y=%y --width=%w --height=%h"
--x=264 --y=387 --width=1204 --height=519

python-xrectsel's People

Contributors

digitronik avatar ulidtko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

python-xrectsel's Issues

Cannot select entire screen

Summary

When I try to select the entire screen, the result is 1 pixel off in both dimensions.
This looks like a bug in xclip because when I select entire screen using maim screenshotting tool, resulting image has correct dimensions.

Excpected result

2560x1440+0+0 (2k screen)

Actual result

2559x1439+0+0

Key error in dragging

❯ xrectsel
Traceback (most recent call last):
  File "/home/ndhandre/Projects/python-xrectsel/.env/bin/xrectsel", line 11, in <module>
    load_entry_point('python-xrectsel', 'console_scripts', 'xrectsel')()
  File "/home/ndhandre/Projects/python-xrectsel/.env/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/ndhandre/Projects/python-xrectsel/.env/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/ndhandre/Projects/python-xrectsel/.env/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/ndhandre/Projects/python-xrectsel/.env/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/ndhandre/Projects/python-xrectsel/xrectsel/console.py", line 19, in cli
    geormetry = xrect.select()
  File "/home/ndhandre/Projects/python-xrectsel/xrectsel/__init__.py", line 136, in select
    return coordinates(start_point, end_point)
  File "/home/ndhandre/Projects/python-xrectsel/xrectsel/__init__.py", line 14, in coordinates
    X["x"] = end_point["x"] if start_point["x"] > end_point["x"] else start_point["x"]
KeyError: 'x'

TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'

No matter how I call the program, it always just errors for me.

$ python --version
Python 3.9.7
$ uname -mor
5.14.14-arch1-1 x86_64 GNU/Linux

Error:

Traceback (most recent call last):
  File "/usr/bin/xrectsel", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1052, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/usr/lib/python3.9/site-packages/click/core.py", line 914, in make_context
    self.parse_args(ctx, args)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 1370, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 2347, in handle_parse_result
    value = self.process_value(ctx, value)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 2303, in process_value
    value = self.type_cast_value(ctx, value)
  File "/usr/lib/python3.9/site-packages/click/core.py", line 2291, in type_cast_value
    return convert(value)
  File "/usr/lib/python3.9/site-packages/click/types.py", line 75, in __call__
    return self.convert(value, param, ctx)
  File "/usr/lib/python3.9/site-packages/click/types.py", line 399, in convert
    return self._number_class(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'tuple'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.