Programming a GUI Like Steam? - python

So I've been tinkering with a few different GUI's but I haven't been able to even find a point to begin researching this question:
How do I make a GUI like Steam (Digital distribution app) has? More specifically, I'm interested in how they manage to make their SHIFT+TAB menu pop up in-game, without disrupting/pausing/effecting the game. I've been somewhat successful in making a GUI window "stay on top" when a game is in window mode, but Steam pops this little menu up over the top of a running, fullscreen game.
That's what I'm interested in learning about. Any info would be much appreciated. :)
Sorry if this isn't the correct place to post this. I wasn't sure exactly where to ask.
PS> Preferably something I could implement in Python!!!

The Steam overlay/notification system hooks into games via Direct3D or OpenGL in Windows (depending on the game) from my understanding (as it doesn't work for games that aren't Direct3d/OpenGL like Diablo).
It uses the same rendering libraries that the game uses and thus can overlay their menus natively.
As for Python implementations, you can check out http://directpython.sourceforge.net/ and http://pyopengl.sourceforge.net/ as a start (for DirectX and OpenGL libraries respectively) but can I warn you that I don't think this is as simple as you're hoping.

Hmm, that looks very much like they are using Adobe AIR or maybe Flash.

Related

What does pygame.display.set_mode() do?

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.

Python compile a script within a GUI

I am currently working on the final year project for my degree. I have chosen to research and develop a tool to aid the delivery of the new Computing curriculum that is coming to schools next year.
I am using a Raspberry Pi in my development, and I aim to teach extremely basic Python programming to children between the ages of 8 and 10. They are going to be able to control some hardware attached to the Pi using a simple API that I am going to create.
My question is: I would like to be able to create a GUI for the children to work in, which would allow them to write and compile scripts. This is mainly to get away from the unfamiliar interface of Linux and terminals etc, and put them in a friendly, basic interface which will pretty much just allow them to write their code and click a big red button to compile and run it to interact with the hardware. Is it possible to allow for text to be written in a GUI and then compiled when the button is pressed?
I am pretty new to Python myself so I am not as clued up as I'd like to be about the specifics of it. I know that it is possible to have the output of IDLE inside of a tkinter interface, and that it is possible to have text boxes for user input and stuff, but would it actually be possible to compile a script on button press and then run it? I have been thinking that maybe threading is the answer. Perhaps I could create a new thread to do it when the button is pressed?
My apologies if this is incredibly basic, but I am having no luck finding any answers about how I would do this. I think it's mainly because I am unsure on what exactly to ask for.
I appreciate any feedback/help, thank you very much.
Dell
Have your GUi write the Python code to a file, then dynamically import using the imp module. I actually do something similar :-)
import imp
hest = imp.load_source("Name", Path)

GUI toolkit for creating fully customized UIs? If I were going for a completely non-os native look, which toolkit would you suggest?

I've been asked to build a gui for a friend. We're going for a fully custom look. All buttons, states, widgets, etc.. will be will be drawn by an artist. The only native widget I foresee needing is a listbox (because I'm not entirely sure how I would build one from scratch).
Additional requirements are mp3 playback support.
The list of available frameworks on python.org is pretty daunting! Could anyone suggest a good starting point?
I apologize for the open ended-ness of the question!
Build it with pygame would be my advice.
That will give you a pixel identical GUI on all platforms - ideal if you have an artist make everything for you.
You'll have to implement your own listbox, but pygame plays mp3s just fine.

Adding wxPython GUI elements in a pygame physics simulation

I have made a pygame physics simulation--'a projectile motion' but it lacks interactivity like accepting angle of launch,speed etc. I am wanting to add input boxes with increase decrease arrows but don't know how to go about it. Thanks for the help.
Maybe you can try PGU (Phil's pyGame Utilities).
In addition to other tools, it has a library for creating GUIs.
This PGU demo shows probably something similar to that you are looking for:
Try Some of these:
http://wiki.wxpython.org/IntegratingPyGame
http://www.pygame.org/project-Pygame+embedded+in+wxPython-1580-2788.html
Good luck!
I don't think trying to add wx-Elements is a very pygame way of implementing a GUI, a better (in sense of portable) way would be to use some all-in-python-GUI-extention for pygame. But the issue of GUI in pygame is anoying, since I could not find any library that offeres such a thing.
I know of two interesting approches, first there is Albow (a little bit of widgetry for pygame), which has a nice implementation of styles. The newest Version (which is not very new, I'm afraid) can be found at http://www.cosc.canterbury.ac.nz/greg.ewing/python/Albow/
Then there is OcempGUI http://ocemp.sourceforge.net/gui.html -- which has documentation and an some good concepts of event handling.
The sad thing is, both projects seem to be dead. I know of no other pygame-GUI that is worth looking at (correct my on that one, please!). For my own project I started to build something inspired by both of them (just don't expect that to ever become useable), since I'm not really content with either of the two. But they might by just the thing if you don't want to put too much time into it and want to have a good collection of GUI elements from labels and buttons up to file browsing dialogs or scrollable text fields.

Picking a suitable GUI framework for project

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.

Categories