Set window size for Ursina Engine for Python - python

I'm using Ursina Engine to make a game. However I can't figure out a way how to set a specific size for the window. I need to figure this out, because I can't see part of it, because it's bigger than my screen.
I tried to use other posts on StackOverflow, but couldn't find anything. I also tried to use ChatGPT, however it didn't help.

A google search led me to the documentation of the engine, where I found this:
https://www.ursinaengine.org/api_reference.html
As I understand it your main app class Ursina(), can accept various arguments, including amongst others 'size'.
Scrolling further down to the part named 'ASCIIEditor' there's an example usage:
app = Ursina(size=(1920,1080))
My experience with Ursina is limited to some introductory videos, so take this for what it is.

Related

Dash/Plotly layout rendering differently on another computer after the deploy

I just deployed a dashboard on Google Cloud and shared it with a friend to check if he could access it. I asked for a screen print to check if everything was ok.
To my surprise, the dashboard that appeared to him is very different from what appears to me. On his screen, the text fonts are all misconfigured and the size of the graphics are different, in addition to not being centered on the screen.
I didn't think this problem would happen, since the dash is online on the internet.
Can anyone tell me how I can standardize the view for any user?
I don't know if it helps but all the layout code (html+css+python) is in the same app.py file.
Obs
There is no Go.figures or Bootstrap in my code. It's just simples plotly charts made with plotly.express.

Adding plain text to a Nuke simple panel window

I work with Nuke all the time and I know simple Python to create simple tools in it. I’ve been able to carry out moderately complicated actions with panels and tools but I am stuck with something that should be very simple, but I can’t seem to find the answer here or in nukepedia or in the foundry help and tutorials. I want to add some simple text to my panel. For example:
p = nuke.Panel('test')
p.message('This is where I hope to display an explanation of the tool')
p.addButton('Quit')
Where I use p.message just as a placeholder for what I need.
Any help would be appreciated, I feel like this is so simple that it isn’t included in most of the documentation.
For windows bringing a simple message use this code:
nuke.message('Explanation of the Tool')
If you need user's yes/no choice, use this code:
if nuke.ask('Do you like to create ColorWheel node?'):
nuke.createNode('ColorWheel')
In case you need a panel, use the following code:
panel = nuke.Panel('Test panel')
panel.addNotepad('Explanation Here','Explanation of the Tool')
panel.addButton('Quit')
..and then:
panel.show()

Get spotify currently playing track

EDIT : Let's try to clarify all this.
I'm writing a python script, and I want it to tell me the song that Spotify is currently playing.
I've tried looking for libraries that could help me but didn't find any that are still maintained and working.
I've also looked through Spotify's web API, but it does not provide any way to get that information.
The only potential solution I found would be to grab the title of my Spotify (desktop app) window. But I didn't manage to do that so far.
So basically, what I'm asking is whether anyone knows :
How to apply the method I'm already trying to use (get the window's title from a program), either in pure python or using an intermediary shell script.
OR
Any other way to extract that information from Spotify's desktop app or web client.
Original post :
I'm fiddling with the idea of a python status bar for a linux environment, nothing fancy, just a script tailored to my own usage. What I'm trying to do right now is to display the currently playing track from spotify (namely, the artist and title).
There does not seem to be anything like that in their official web API. I haven't found any third party library that would do that either. Most libraries I found are either deprecated since spotify released their current API, or they are based on said API which does not do what I want.
I've also read a bunch of similar question in here, most of which had no answers, or a deprecated solution.
I thought about grabbing the window title, since it does diplay the information I need. But not only does that seem really convoluted, I also have difficulties making this happen. I was trying to get it by running a combination of the linux commands xdotools and xprop inside my script.
It's worth mentionning that since I'm already using the psutil lib for other informations, I already have access to spotify's PID.
Any idea how I could do that ?
And in case my method was the only one you can think of, any idea how to actually make it work ?
Your help will be appreciated.
The Spotify client on Linux implements a D-Bus interface called MPRIS - Media Player Remote Interfacing Specification.
http://specifications.freedesktop.org/mpris-spec/latest/index.html
You could access the title (and other metadata) from python like this:
import dbus
session_bus = dbus.SessionBus()
spotify_bus = session_bus.get_object("org.mpris.MediaPlayer2.spotify",
"/org/mpris/MediaPlayer2")
spotify_properties = dbus.Interface(spotify_bus,
"org.freedesktop.DBus.Properties")
metadata = spotify_properties.Get("org.mpris.MediaPlayer2.Player", "Metadata")
# The property Metadata behaves like a python dict
for key, value in metadata.items():
print(key, value)
# To just print the title
print(metadata['xesam:title'])
For windows:
The library can be found at github: https://github.com/XanderMJ/spotilib. Keep in mind that this is still work in progress.
Just copy the file and place it in your Python/Lib directory.
import spotilib
spotilib.artist() #returns the artist of the current playing song
spotilib.song() #returns the song title of the current playing song
spotilib.artist() returns only the first artist. I started working on an other library spotimeta.py to solve this issue. However, this is not working at 100% yet.
import spotimeta
spotimeta.artists() #returns a list of all the collaborating artists of the track
If an error occurs, spotimeta.artists() will return only the first artist (found with spotilib.artist())

GAE or Maps API3 Store Locator with Python? (Easy Version)

I'm tasked with creating our Google Maps website store locator and so far all I've been able to find is old php tutorials and some new appEngine apps.
The apps look great. They seem to function as designed and it looks like this is the way I need to proceed. I even found a demos here and here and both are perfect.
Problem is, I'm not at the level yet to understand them in order to learn from them and start implementing my own app for our stores. I do plan on using them to learn, but at the moment I'm not at that level yet so I'm not even really learning anything by examining the code.
Is there anything I can use at the moment that is a plugin option while I learn this? Perhaps any python tutorials out there hiding somewhere? I can learn these demos but I really need something for the time being while I'm figuring it all out.
This demo from 2008 might be a bit old but will put you on the right tracks.
There is also locator in geodatastore. Demo

How can I embed Google maps into a wxPython program?

I would like to create a program using wxPython that uses Google maps to display and select geographic data.
Is there a proven, ready to use widget for this?
There are no pre-made widgets that I'm aware of. I did find PySlip, which is similar to what you're talking about: http://code.google.com/p/pyslip/wiki/Introduction
There is a webkit port that's being worked on for wxPython as well. There's a preview build here that's kind of old:
http://wxwebkit.wxcommunity.com/index.php?n=Main.Downloads
I know the author has been working on an update to it for quite some time though.

Categories

Resources