Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've got a university project in which I should make the Pac-Man game on Google maps, meaning that the game should find your location on Google maps and use the streets in the map as game map (like the following picture).
enter image description here
I'm only allowed to use C++ and Python , and I can use Qt for making GUI.
I think I should use Goole Maps API but I don't know how to work with it.
I have no idea how to start this project and I'm wondering if anyone can help.
Thanks for your help.
Break down the problem into smaller chunks until you get them to the point that you can start writing code.
Find a pacman clone out there for Qt or python.
I would also make sure you understand nodes and maze generation.
JSON Api
The Maps API likely uses a lot of JSON. Either study: http://doc.qt.io/qt-5/qtcore-json-savegame-example.html
or use var map_data = JSON.parse(reply); if you go with QML/javascript
Study up on the google maps api and how to get the data you want. Then get the data to printout to the console using QDebug statements.
Graphics
In almost any graphics packages, including Qt, you need to think in terms of the layers and draw elements from the bottom up. The Qt Widgets framework, the Qt Graphics View framework or the QML framework are all great for drawing these kinds of things...
QWidget-based or QGraphicsItem-based
Bottom (drawn first)
Google Maps Image -> stored in a QImage or QPixmap or painter.drawPixmap() or QGraphicsPixmapItem()
Google Maps Paths/Roads -> QGraphicsPolygonItem or QPainterPath or QLine's or QGraphicsLineItem
Yellow dots -> painter.drawEllipse() or QGraphicsEllipseItem
Pacman -> painter.drawArc() or QGraphicsEllipseItem
Ghosts -> painter.drawPixmap() or QGraphicsSvgItem
Top
Using QGraphicsColorizeEffect you can get the sub elements to colorize nicely or flash.
Movement can be animated with QPropertyAnimations.
If you are considering deploying to mobile/smart phones or tablets, then QML is a preferred option. Look at the examples in v-play for QML games. Download the v-play sdk, and then look at all the examples it includes. The tower defense game is probably similar to what you are making here.
The elements in QML are similar to other Qt classes, but are much more friendly for OpenGL ES 2, and can render and run much faster on mobile platforms.
QML Elements
Bottom (drawn first)
Google Maps Image -> Image
Google Maps Paths/Roads -> Path
Yellow dots -> Rectangle { height: width; radius: width*.5 } (a rounded rectangle)
Pacman -> PathArc
Ghosts -> Image
Top
Colorize or HueSaturation elements to change the color of images.
http://doc.qt.io/qt-5/qtquick-usecase-animations.html for how to do animations.
More links
https://qmlbook.github.io/
http://doc.qt.io/qt-5/classes.html
https://v-play.net/
https://developers.google.com/maps/
https://www.google.com/search?q=maze+in+qt
https://www.google.com/search?q=pacman+in+qt
How to add Google Maps in my application in Qt?
Hope that helps.
Related
I am trying to create a drag and drop app (like how the Unreal engine does with events - e.g. here) in Python using wxPython Phoenix.
I have found this Stack Overflow question which I have figured out how to adapt to make it draw a rectangle, but I can't figure out how to have connector nodes and to draw lines between the rectangles.
Can anyone link me a good tutorial or demo program please (which would be greatly appreciated) as a starting point.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Trying to find the recommended (i.e. community-best-practices) framework for a Raspbian-based application to create a simple read-only (i.e. kiosk-like) user interface with only a few requirements:
It has to be able to run full-screen (i.e. no visible chrome, titles, clock, etc.)
It has to support the display of text strings using a non-raster font (i.e. TTF, ODF, etc.)
It has to be able to draw basic, primitive polygons via line segments and coordinates. (Displaying SVGs would be optimal, but I'm fine hand-drawing the line segments too.)
The entire screen/canvas/??? has to be 'rotatable' so any direction can be 'up'.
Some have directed me to TKinter, but I think that's a mistake as that appears to be for building application GUIs in Python (i.e. buttons, text boxes, list boxes, etc.)
Others have suggested PyGame but they seem a little overkill as that's a full-on gaming engine whereas I just need basic, non-animated display. Plus I haven't found any tutorials on how to make them full-screen with the rotation requirement addressed.
I've heard GTK/GTK# is also something worth looking into but that too seems overkill bringing in the entire Mono frameworks along for the ride (although I do love C#!)
I've searched for tutorials or similar using Google, but nothing seems to be a good fit. Getting to the point where I'm just going to 'grab one and run with it.', but I'd prefer to end up where the community considers best-practices.
I recommend Tkinter/tkinter because you
need a graphical interface for your
purpose.
It is part of the python standard
library you don't have to install an
additional library to use it.
It's able to run in full-screen.
You will need text boxes to display
your text strings. Just disable the
border then it will look like without
box or use the Canvas frame and display
your items and text.
Tkinter has a Canvas frame you can
draw all primitive polygons like arc,
line, polygon, rectangle and text as
well.
It's not clear for me what you mean
with rotatable I assume you have a
display like your tablet or mobile phone
so when you rotate the display it should
rotate your screen too? If so then you
need access to the tilt sensor. You can
in tkinter rotate your window or canvas
as well.
For me best GUI framework because easy,
fast to use, for small and big projects,
native and modern look, cross-
platform...
The only drawback: can not display
images without third party library
except bitmap.
I don't recommend PyGame it's overkill.
I don't recommend GTK because it's not
easy as tkinter but you can use it and
achieve the same result like with
tkinter.
I am a developer with low vision. Right now I am working on a personal project to improve my ability to make use of large screens and play video games.
Sometimes when using a widescreen monitor up close (within 4-8 inches) I have trouble reading the screen along the edges. This is particularly troublesome when trying to read the clock or use a mini map in a game. It would be nice if I could temporarily switch the edge of the screen with the center.
I have successfully been able to move parts of the screen using screen captures and PyQt (screenshot).
This is nice but I would like to do this while preserving my ability to click or select text in the region. This seems like a rather involved process If I want to use PyQt and somehow pass clicks through to the screen.
For example:
Is there a lower level api that would allow me to tinker with the screen's output? Any suggestions are welcome!
Thanks
I am looking to make a GUI in python but currently do not have much experience. The GUI must have a few key features, namely a slider bar to control audio, and a few basic menu buttons. I realize essentially all GUI development tools could handle these simple features, but I am also interested in some custom content as well. The basic look of the GUI I am looking to create is shown here:
In the image, the slider volume bar, "button1," "button2," the colored circles, and any slice of the circle (one highlighted section is shown) needs to be clickable and interactive. Moreover, the small colored circles must be able to dynamically revolve around the edge of the circle and remain clickable at all times. I have not used any GUI development tools yet, but have looked into pyGTK, pyQT, wxWidgets, and Kivy. Can anyone who has used these tools recommend which would be best suited? As far as shapes of buttons, am I restricted?
You can use pyopengl, pygame , pygtk .
I have one example how to show this images if you want take a look at :
http://free-tutorials.org software free section is decor.tgz example.
In my opinion you can use pyOpenGL is very portable to another language like C,C++ and also you can make it to Linux , Windows , Android.
I am starting out on a project in which I need to build a customized annotation tool for movies and video. Some person (not technically minded) will need to pop open a GUI that I create, open either a video file or a directory of frames that result from chopping up a video file, and then use a window (much like QuickTime or VLC player, etc., i.e. a video window with a simple slider bar allowing the user to move back and forth at will). In this window, the user will be able to click on interesting points, give them semantic labels and meta-data (such as whether or not the point is occluded by something else in the picture), and then basically "press go" and start a tracker. The tracker will follow the points, frame by frame and the user can press the space bar or something to move forward and backward. The idea is to allow the human to intervene any time the tracker gets confused, but hopefully the tracker works well enough that humans don't have to hand-label every frame in an entire multi-thousand frame video sequence.
I am planning to do this all in Python, (a) because it is the language I know best for non-trivial programming, (b) I have easy access to both OpenCV Python (for image processing algorithms) and PyQt which seems to have a powerful enough GUI toolbox for what I want to do and (c) some other aspects of this same project are being developed by other programmers to work in Python and with MySQL databases. Python just seems like the natural choice to streamline it all together.
I am experienced using computer vision algorithms for the tracking, and I am reasonably sure that I can figure out simple PyQt GUI devices for making points clickable, buttons, entering simple text data, etc. However, the part I am having trouble understanding is how to actually construct my own video window with a slider bar that either moves ahead according to a frame's number or else is actually manipulating a video file. Can I leverage other movie players like VLC from within PyQt when programming in Python? Any suggestions or links that describe similar movie/video editing GUIs and how to develop them at home would be greatly appreciated.
Qt(PyQt) has a good multimedia support via Phonon module. You can easily use that module to achieve Video window, it can provide an easy-to-use video player and you can get playing position etc.