I’ve got the basics down of python, and have a good understanding of the language. I wanted to start with graphics, but there is a serious lack of tutorials covering python graphics. Now, don’t get me wrong. If you look up ‘python graphics tutorial’ there will be thousands of results, but the problem is they all cover how to create graphics in python using an external module... and since I’d like to have a deep and clear understanding of the language, I don’t think a library/module will be that good of a choice. Help?? Thanks anyone! Very Happy
Well, Python is pretty much all about using modules. It doesn't really provide its own particular GUI and graphics support in the way that Java, for instance, does. But if you really only want to stick with the built-in libraries and not third-party ones, I think your choices are pretty much limited to turtle graphics with the “turtle” module and the tkinter GUI toolkit itself.
But aren’t those modules built off python? Meaning that python purely could be used to create the same effect?
The modules have to use OS services to do those things, and the only way this is possible is via wrapper libraries built in compiled languages like C, designed to allow Python code to communicate with the system. So there has to be at least a little bit of non-Python bit of code involved in making any of these sorts of libraries.
I’ve heard of PyGame but I’ve never really liked the idea of using these third party things, mostly because I want to say, “I programmed this in python”. Not “I programmed this in python using PyGame and this other third party thing”. Idk, it’s probaly a nuance beginner thing.
PyGame is actually just a layer built on SDL. If you programmed a game in C using SDL, you'd still have used a third-party library. If you wrote a program in C linked against Microsoft Windows's API layer for making graphical Windows applications, you're still making use of some of Microsoft's code at some point. That doesn't make your code any less of a C (or whatever language) application. In Python, some of these libraries don't do much more than translate the raw library's interface into something that Python code can work with anyway, making them not a whole lot different from using the library directly using whatever language they were originally designed for (other than performance, perhaps).
Welp since so far I’m merely a novice to this stuff... I didn’t understand about 75% of the last post. And if python can’t be used for graphics, I don’t really know what to do
Jcsq6 wrote:
Welp since so far I’m merely a novice to this stuff... I didn’t understand about 75% of the last post. And if python can’t be used for graphics, I don’t really know what to do

Of course you can write graphical applications in python. It's probably the easiest thing ever. What are you trying to do?
It can, but not without a module of some sort (whether the official built-in ones or a third-party one). If you really want to avoid all third-party code, then you might as well write an entire computer operating system from scratch. Avoiding modules in Python isn't realistic. That was the way Python was intended to be used, and that's one of its strengths.

In short: The core Python language was intentionally designed to be very simple and rudimentary. Like C, it can't do much without external libraries.
MateoConLechuga wrote:
Jcsq6 wrote:
Welp since so far I’m merely a novice to this stuff... I didn’t understand about 75% of the last post. And if python can’t be used for graphics, I don’t really know what to do

Of course you can write graphical applications in python. It's probably the easiest thing ever. What are you trying to do?


I’m just trying to learn and fully understand the language... but the thing I don’t like about modules is that they are other people’s code, and I don’t like using that, and then claiming it as my own. I wonder if I just have a serious misunderstanding of this whole thing...

And yes.... I am the common idiot that doesn’t understand the difference between python and python modules
Jcsq6 wrote:
MateoConLechuga wrote:
Jcsq6 wrote:
Welp since so far I’m merely a novice to this stuff... I didn’t understand about 75% of the last post. And if python can’t be used for graphics, I don’t really know what to do

Of course you can write graphical applications in python. It's probably the easiest thing ever. What are you trying to do?


I’m just trying to learn and fully understand the language... but the thing I don’t like about modules is that they are other people’s code, and I don’t like using that, and then claiming it as my own. I wonder if I just have a serious misunderstanding of this whole thing...

Well get over it; any code you write will be trash compared to the Tkinter library. It's a simply library like numpy that you simply write "from tkinter import *" at the top of your program and then just use the functions.

https://www.python-course.eu/tkinter_canvas.php
If you want to fully understand the language, I'd focus on the core language, then (which doesn't include graphics, as that's not part of the language itself). In other words, everything that you can do without any “import” statements at all. Once you've mastered all that, you've learned pretty much everything you need to know about Python itself. Edit: All import libraries are either built from the core Python language or from support code written in a language that can interact with the system or other libraries, or a combination of the two.
But that’s like using p5.js for javascript right? It’s like you’re not really using the real language.

That was to Mateo btw...
Lol
Ok y’all I realize I’m an idiot and a newbie... but cut me some slack I’m just trying to learn.
Jcsq6 wrote:
But that’s like using p5.js for javascript right? It’s like you’re not really using the real language.

That was to Mateo btw...

No widely used programming languages (C, c++, java etc) have graphics or any other IO for that matter as part of the "core" language (except maybe some very basic stuff). They all rely on libraries to do IO stuff.
I’ve got the basics down of python, and have a good understanding of the language. I wanted to start with graphics, but there is a serious lack of tutorials covering python graphics. Now, don’t get me wrong. If you look up ‘python graphics tutorial’ there will be thousands of results --->>>> It doesn't really provide its own particular GUI and graphics support in the way that Java, for instance, does. But if you really only want to stick with the built-in libraries and not third-party ones, I think your choices are pretty much limited to turtle graphics with the “turtle” module and the tkinter GUI toolkit itself. --->>> DONE!
Python by itself isn't capable of accessing the screen. Modules and libraries don't implement graphics functions themselves, but wrap around a lower-level API written in a language like C or C++ which interact directly with the system. So, if you tell a library to draw a triangle, rather than figuring what pixels to put on the screen, it will simply tell another library, in a different programming language, to draw a triangle.

Of course, there's nothing stopping you from limiting yourself to only using the library function for setting pixels, and writing the other graphics functions in Python, except that it will probably be incredibly slow.

I don't recommend doing this though, as Python isn't the best language for writing graphics routines. If it was, the libraries would be written in it rather than a lower level language.

If your intention is to learn how graphics functions work, you could give it a shot, although there will be very little documentation and most example code will be in another language.

If your intention is to learn about Python in general, I would avoid reinventing the wheel for graphics libraries and instead focus on your game logic.

Also, what program are you making? Is it a game, and is it 2D or 3D?
I’m just trying to learn to make graphics... I have all the, if you will, backbone figured out. But I don’t have any sort of graphics capabilities and I’m trying to figure it out.
You might find things different using, say, Visual Basic, for example. That's a good place for a beginner with your criteria.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement