ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i have yet to see a single simple program in a common (comes builtin on major Linux distros) interpreted language that generates the pixels of an image and brings it up in its own window. i was most hoping for something in Python3.
edit 1:
ideally, i'd like to see Python code that actually does the pixel work, itself, instead of calling some library. or maybe the library, itself, if entirely coded in Python3 (no C/C++, that would be cheating). getting the image to display with some library commonly available for Python would be OK.
what language is that written in? i thought it was originally in assembler and now in C.
> What are you trying to do?
make a choice about which GUI library in Python will serve my needs, especially the main loop functionality.
> You may be looking for something that does not exist. Pixel code is written in C/C++ for good reason.
possibly true. i know Python gets used for lots of GUI things. maybe one of them needed to work with pixels. if they used C/C++ for that part, that's the kind of thing i wanted to see. i do know how to do bit manipulations in Python. there may be tools to do this and someone may be using them.
> OpenCV has Python bindings.
that could be what programmers use. if so, i want to see a Python program using it.
> What are you trying to do? (linked to a web page about The XY Problem).
there is a good reason that justifies asking about Y (and X and Z and so on). that is when evaluating different approaches to solving a problem. i don't want some else to decide for me. i just want to know about many solutions (if there are many) and eventually make the decision or let my boss do so.
What NevemTeve says - I couldn't make sense of what you're asking, and now that I possibly have a slight inkling, that doesn't change my response - context is important.
Did you read the "What to do about it?" section of that link? Specifically point 3?
It's not about asking about X instead of Y - it's a matter of giving detail: showing enough of your working to get people on the same page as you, so they understand what is being asked and can provide more relevant answers.
There's no issue with saying "I'm trying to evaluate different options for doing <X> and would prefer an something that uses <method Y> because <reason>; everyone else seems to solve <X> with <Z> but <problem with Z> so I want this thread to focus on <Y>"
Especially when trying to decide between different options, this provides people with the relevant information to suggest the available solutions - it doesn't change that you get the final choice in which advice to follow/ignore.
i am the kind of person that understands things by example. i believe examples of usage will help me understand the capabilities of various GUI libraries that could be my choices in Python. thus i have been looking around for examples. everything i find, so far, either does not work with image pixel data, or ends up in C to display images. as EdGr points out, this may not exist. based on my search so far. i can believe that. i also believe my search is not, yet, exhaustive. what i am seeking, in this thread, are contradictory examples.
On the contrary, I'm fairly certain every Python GUI library worth considering has the means to read and write pixel data, without you having to know or care about C. (Their behind the scenes implementation may use C/C++ but that's entirely irrelevant.)
Examples for any of them is a trivial search away, so either you're searching for completely the wrong terms, or your needs are more complex than "GUI library in Python ... work with image pixel data" and need to be better explained.
Skaperen - check out Cairo, a powerful 2D drawing library. It even has Python bindings.
Your program should call Cairo's drawing primitives whenever possible. If your program must draw pixels, Cairo provides an image surface to draw on. Be aware that using Cairo's drawing primitives will be faster than drawing pixels yourself.
Ed
Did you read the "What to do about it?" section of that link? Specifically point 3?
there is an absence of solutions meeting my needs. i have avoided code in C/C++/Java as not useful. i have avoided code that does not manipulate pixels. an example that does is one that loads an image file and changes some pixels before displaying in the window it is working. this could be the image of a house with a backgroundd name of the seller or real estate agent added.
Quote:
Originally Posted by boughtonp
There's no issue with saying "I'm trying to evaluate different options for doing <X> and would prefer an something that uses <method Y> because <reason>; everyone else seems to solve <X> with <Z> but <problem with Z> so I want this thread to focus on <Y>"
i suppose the method you refer to here could be the language. the problem with Z is that these solutions do not apply to X, where Z is C and X is Python3.
Quote:
Originally Posted by boughtonp
Especially when trying to decide between different options, this provides people with the relevant information to suggest the available solutions - it doesn't change that you get the final choice in which advice to follow/ignore.
i am looking for how this is done in Python3 rather than C/C++ because the memory model, how pixel data might be commonly worked with, including how manipulated with the code. a program that just reads a file and displays it will show a choice of the way the library is used to get pixels in the same way the display library can handle it. these libraries may even support multiple formats in common. the requirement to manipulate pixels constrains this to using a data format with direct access to the pixels. if the program manipulated the pixels via a library call or option (like a option to add a border) then i would rule that out because the format may not be raw pixels. OTOH, if it reads the file in NETPPM (regardless how stored in the file) format in Python3 and displays that, it is likely good enough.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.