I am currently in the planing stage of building an interactive periodic table of the elements program in python 3. It won't be a super advanced program, since I am only a beginner in python 3 (4-5 months of self-training).
Basically, when you click on an element of the periodic table, you will look at its properties in more detail and would have a dynamic 3D view of the an animated atom (with the electrons circling around it) which I would create in Blender. Here is a simple mockup I just made for people who are visual (lots of stuff missing here, but it's only the basic shell).
Ok, so my question is: How can I interact with 3D objects in Python 3? I have searched, and have found that PyGame can handle this, but it seems it's not the best to handle 3D graphics, and I am not sure if PyGame is ideal for this kind of program. Of course, there is vpython, but it doesn't work with Python 3. So how can I manage to do this?
Please keep in mind that I am a beginner, so any resources you think can help me would be of great appreciation!
Thanks to all.
The easiest could be to use images and videos.
But if you want to manipulate 3D, there are PyOpenGL and VPython.
PyOpenGL provides low level interface to display 3D objects.
PyOpenGL can be used with PyQt or PyGame to have a 3D display within a 2D GUI.
Edit: there is also a build of vpython for 32bit python 3.1 on windows
Related
I have recently started learning python and decided that a fun way to learn would be to use pygame.
The following is some code that sets up the the window.
screen = pygame.display.set_mode((1200,800))
Would pygame be a file in which the file display is located?
I assume display refers to a file in which the method set_mode() is located.
If you already have a basic understanding of Object-Oriented Programming but are learning python through pygame, then Have a read through this tutorial: pygame - Setting Display Modes
Setting the display mode in pygame creates a visible image surface on the monitor. This surface can either cover the full screen or be windowed on platforms that support a window manager. The display surface is nothing more than a standard pygame surface object.
If you are starting to learn python and or programming from scratch, you might find more value in learning some basic programming and problem-solving concepts first, then come back to pygame.
I'm not affiliated but find the Hacker Rank 30-day challenge as a great learning tool, it is unique in tutorial sites as it is language agnostic and allows you to learn multiple languages at the same time if you wish to do so! It is also a good environment to learn in as there are fewer IDE features, forcing you to understand more before you can move on.
The average desktop IDE is not a great place to learn how to program because it will often have features like Intellisense, Autocomplete and other smart refactoring tools that allow us to write code quickly, but they allow you to "cheat" and skip over vital underlying mechanics that you need to understand if want to take advantage of abstract knowledge resources you may find around the web, like solutions in Stack Overflow!
Once you have a better understanding of syntax and how to use your chosen IDE, then go back to your pygame learning, walk before you run.
I need to create some program that will calculate some thermodynamics properties. I write on macos, python 3 because python has the necessary library.
So i have the problem with GUI. I learn and try to create simple grid for my application, but the actual behavior of the elements is very different from the one conceived (or doesn't work). I don't understand how to create right grid for my app. When i studied bootstrap, i needed one evening for understanding, and after that i could to create grid very easy, but here is hell.
Please help me. I want to understand how i need to create right grid system for my app
my Application layout:
I have a project where I have to show some sort of changing bar graph with results from a function. This bar graph should be in colour and 3d. I want it to look good since it's an open source educational program where it teaches the user about different voting systems and how they effect the outcome of an election. I would like to use python but I have no idea about using GUI frameworks since all my work in python has been command line based. Your help will be appreciated.
For 3D graphics, you might want to use OpenGL with a game framework, such as PyGame or Pyglet. Use matplotlib as TJD suggested in the other answer.
As for GUI frameworks, they generally won't help much with 3D graphics:
PyQt is one choice; I see you already have it in the question tags. PySide is very similar to PyQt, but with a nicer licence.
Then there's tkinter (in the standard library), wxPython, and pyGTK – I hear all of them are good, though I don't know them personally.
Pick one and stay with it. It'll take some time to learn if you're not experienced, so don't expect results too soon.
You might want to look at matplotlib, which is probably the most widely used library for doing graphs, including 3-D.
I'm pretty new to programming, and I'm creating a simple text-based game.>
I'm wondering if there is a simple way to create my own terminal-type window with which I can place coloured input etc.
Is there a graphics module well suited to this?
I'm using Mac, but I would like it to work on Windows as well
Thanks
The Tkinter Text Widget will do what you ask. the IDLE main window is implemented as one, if you want to play with an example.
You could use the termcolor library - it that what you're looking for?
On Windows things are trickier. See this SO answer - you should resort to win32console and some ctypes. The answer has some code and links to other articles.
For game programming with Python, I would always recommend PyGame.
It is not very complex and enables you to easily use input, graphics and sound.
As a start:
http://www.penzilla.net/tutorials/python/pygame/
I need a tile/sprite editor kind of like Pixen, but I couldn't find one for Windows so I thought it might be a good exercise for me to try and put one together. I use Python, so are there any libraries out there that are suited to the task of putting together a simple tile/sprite editor?
You just need a gui toolkit (gtk, qt, wx) a image library (PIL) and 500 hours of free time ...
Have you looked at the Python Imaging Library (PIL)?
So, the fact is that creating a complex app with a nice UI takes time - I am just expanding a little bit on the answer by THC4k.
PIL, at least PIL alone is useless for this: it does have some functions to manipulate images, but the complicate task here is creating and tunning your desired UI.
That's where the widgets toolkits come in: You would have to pick a toolkit platform that can offer you buttons, images, load and save the image files, maybe some specialzed widgets you can use to create your color swatches, etc.
both GTK+ and QT4.5 have a liberal license, are very complete and very unpythonic on their use :-(
(While you are at it, when using these libraries and toolkits our app can easily be multiplatform: you don't have to make it windows specific, it is equally easy to create an app that will run on Windows, Linux and Mac using python and either GTK+ or Qt4)
One thing I would suggest is for you to learn to proper use GIMP: it is an Image editor, and certainly it will lack a lot of tools you are needing for sprites: but you can expand it's capabilities with Python plug-ins. On the other hand GIMP does have thousands of features that you'd no longer will need to create for your stand-alone app. (think on layer support, color filters, image rotation etc...)
Check around on how to install GIMP with Python support on Windows, then spend some hours learning the app, with some book-like text around preferably so you can find the hidden features.
Ah, ok, finally:
If you want a very simple thing, just for the taste of "i did it" - you can use Pygame: You have to do all the drawing on the window, including text - but have straighter access to pixels, colors, mouse clicks and coordinates than with GTK+ or Qt, in a sense it would be a lot less of overhead for you to learn in terms of API's and internal working.
You could try PyGame but, seriously, you couldn't find a freeware graphics editor for Windows??!!
EDIT: In the past I've used Aha-Soft's IconXP for pixel work, but it costs USD 30 and doesn't offer all of the Pixen features that I guess you'll want.