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.
Related
I'm building a 2D simple projectile motion simulation. I have the GUI layout on the PyQt5 side set (with buttons/dropdowns/checkboxes, but none work yet), and the VPython physics code set as well. I have a large area of the windowed application meant to show the screen (the same one that would pop up in a browser with only VPython code). I can't figure out how to connect the simulation visual to that portion of the window, so how would I do that? What widget should I use?
It's also worth mentioning that I am at an intermediate level with VPython and Python itself, but a complete beginner with PyQt5, so I've built the whole GUI in the Qt Designer.
I don't know if it's worth posting my code here as all of it is completely unmodified Qt Designer code with no references to VPython, but here's the code for the black box, which was placed in the UiMainWindow() class:
self.simulation_view = QtWidgets.QOpenGLWidget(self.centralwidget)
self.simulation_view.setGeometry(QtCore.QRect(70, 10, 961, 541))
self.simulation_view.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.simulation_view.setObjectName("simulation_view")
Here's a screenshot of the GUI, with the black box being an OpenGL widget (which is probably wrong for my case) where I want the simulation to appear:
My guess is that this won't work, because I might expect VPython's event loop and PyQt5's event loop would fight with each other. A different approach would be simply to use VPython's widgets, which includes buttons/dropdowns/checkboxes. I'll comment that for VPython questions it's better to post to the VPython forum, where there are many more VPython users who will see your question than if you post to stackoverflow:
https://groups.google.com/forum/?fromgroups&hl=en#!forum/vpython-users
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.
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.
I've been practicing my python/mel coding and have been interested in creating a graph editor. I did a lot of research online and found this previous question (How can I keep an object selected in the outliner after physically deselecting it in the 3d view?) that helped me out a lot. However, I am having an issue were I cannot manually edit the curves that are generated. I'm unsure as to why this is happening and can't seem to find any clear documentation. (I've looked up the command references for mel/python in Maya but it doesn't seem to have detailed explanations).
To be more clear, my goal is to use my mouse to move the curve information based on keyframe data (Exactly like Maya's own graph editor). I am using the code solution from the previous example (edited to include my own selection connections and frame conventions).
So after some research I decided the easiest thing was to use Maya's own graph editor within my interface
# GRAPH ROW
# Section for the graph editor to allow the user to change attributes
paneLayout( configuration='single', parent=form, width=620, height=320 )
# queries Maya's graph editor and places it within my frame
graph = cmds.getPanel(scriptType='graphEditor')
cmds.scriptedPanel( graph[0], e=True, unParent=True)
cmds.scriptedPanel( graph[0], e=True, parent=frame1)
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.