.Hi everyone,
I`m still pretty new to python so, bear with me.
I am trying to setup a custom UI Window in maya, with a custom camera.
For this i am using the panelLayout, modelPanel and modelEditor commands.
Now, it's working so far with one exception.
The flags i've set for the modelEditor seem to be ignored entirely and i dont know why.
So here is the code:
if cmds.window("myWindow", exists=True):
cmds.deleteUI('myWindow')
cmds.window("myWindow")
cmds.paneLayout(configuration="single", w=1000, h=500)
cmds.modelPanel()
cmds.modelEditor(modelPanel="modelPanel4", allObjects=False, polymeshes=True, imagePlane=True, displayAppearance="smoothShaded")
cmds.showWindow("myWindow")
I want only polyMeshes and imgagePlanes to show in this window, aswell as to have the displayAppearance set to "smoothShaded".
Nnothing else, including the grid, should be visible at this point.
but, everything show up in the window, as if i had'nt set a single flag.
any help is much appreciated
All the flags in modelEditor() work fine in Maya 2016.5 and Maya 2018. I've checked it.
import maya.cmds as cmds
if cmds.window("myWindow", exists=True):
cmds.deleteUI('myWindow')
cmds.window("myWindow")
cmds.paneLayout(configuration="single", w=1000, h=500)
cmds.modelPanel()
cmds.modelEditor(modelPanel="modelPanel4",
allObjects=False,
polymeshes=True,
imagePlane=False,
displayAppearance="smoothShaded")
cmds.showWindow("myWindow")
The problem might appear when you click myWindow or press any key. It'll show not perspective view (modelPanel4) but the other view (for instance camera1 view).
Related
Beginner in the whole Python/Anki thing. Learning more about coding for fun and I have set up a debugging environment with pycharm and an Anki profile with the bazelfixes and it seems to start anki up fine. I want to append an extra dropdown menu on the main menu toolbar in Anki so that I can connect the actions to my functions.
I went through the hooks and the toolbar hook worked but it is not exactly what I was going for because it adds to the toolbar, not the menu. I want to add a new dropdown into the actual main menu next to tools, help, etc. connect them to functions I have made. Kind of like this
I have looked at others and sometimes they work partially but it's like a fragmented puzzle some use qmainwindow and it makes a popup separate from anki when I run it, or other approaches where they use the aqt.mw.form() functions in various ways but when I do it it will be like "nonetype doesn't take .form function." or form is not an expected argument. I want to figure out the first basic step.
I have also looked at the aqt MW thing but I am kind of confused about how it works so I am not sure if that is a better approach to read up on. The whole class>def variable> mw.append type of structure I have been seeing in other's code is a little confusing for me. Or am I going about it the completely wrong way and should use html/CSS? Any help or advice is greatly appreciated!
Also here is the bazelfixes code I have been using on pycharm.
try:
import bazelfixes
bazelfixes.fix_pywin32_in_bazel()
bazelfixes.fix_extraneous_path_in_bazel()
bazelfixes.fix_run_on_macos()
except ImportError:
pass
if not os.environ.get(“ANKI_IMPORT_ONLY”):
aqt.run()
TL;DR How do I, within this code on pycharm append an extra dropdown item on the main menu bar. Is there a hook I am missing (not the init toolbar one)? Or a different approach I should try?
I built a small GUI using Tkinter. The GUI features, among some other elements, three buttons. These buttons serve to open a dystem dialog and select certain data-files etc. One of the three buttons is a 'Go' button that runs the underlying data-processing.
When running the .py script the GUI works fine. However, after creating a developer app in alias mode using Py2App the buttons have become invisible! They're still there and usable, but invisible until interacted with.
How can I prevent this from happening?
I was stuck in your exact situation for quite some time. When I ran my tkinter script, it worked perfectly and all the buttons showed up, but once I packaged it, the buttons stopped showing up (They were still there but you couldn't see them). After a long time of trying random things, I found out how to make the buttons and their text show up again. Simply resize the window. Even a difference of 1 or 2 pixels does the trick. I have not yet found a way to PREVENT this issue, but at least this makes the app look right.
Please reply if you figure out a solution to prevent this!
Good Luck!
I am trying to code a message box that just pops up and says something and has a single button to close it however as I only have a small amount of text in the box the icon/image to the left of it is huge and looks bad. I want to know how to remove it. I am also having trouble making custom message boxes. Tutorials say that this is how you make a custom message box:
box = QMessageBox()
box.setText('text')
box.addButton(QPushButton('Close', self))
box.exec_()
However this just closes my program and returns a 1. My current code uses the about method of QMessageBox():
box = QMessageBox().about(self, 'About', 'This is a test Program')
However this has that large icon in the text window and I can't seem to do anything else to the box as it just stops the program and returns 1 again
I am in desperate need of some decent PyQt documentation. I can't seem to find documentation on much at all unless it is in C++. For instance I cannot seem to find any information of options other than question and about for QmessageBox. So if someone could also show me where some proper documentation lives it would prevent me asking too many questions here
Rather than PyQt documentation, it is better to directly use Qt documentation. You only need to switch your language mindset from Python to C++, there and back. It is not that difficult. :) See e.g. http://doc.qt.io/qt-4.8/qmessagebox.html#addButton or http://doc.qt.io/qt-4.8/qmessagebox.html#about I think this is very detailed documentation, unrivaled by most other frameworks.
Note that there are three overrides of addButton(). From the documentation it seems that you either need to pass two arguments to box.addButton(QPushButton('Close', self), QMessageBox.RejectRole) (you forgot the role!) or better, you use the override which uses standard buttons, then you only pass one argument: box.addButton(QMessageBox.Close).
And one more tip for you: I also find it easier to debug my program with PySide than PyQt because unlike PyQt, PySide catches the exception, prints that to console and keeps running. While PyQt usually just silently crashes leaving you clueless. Most of the time, I am using shims Qt.py https://pypi.python.org/pypi/Qt.py/0.6.9 or qtpy https://pypi.python.org/pypi/QtPy to be able to switch from PyQt to PySide on the fly. It also allows switching between Qt4 and Qt5 bindings easily.
I want to set the resolution of my application as per the resolution of the system screen its running on. i want to be on top and also in full screen covering even the taskbar as i am using windows. i want the app to open like the ATM interface, so the app should fill the entire screen.
please help me to find the solution.
thanks
The frame object has a "ShowFullScreen" method that you could use. I just tested it and it works alright, although it doesn't show the title bar of the app. I don't know if you care about that though.
EDIT: Uh, to call a method on the frame object, you would do something like
self.ShowFullScreen(True)
or
myFrame.ShowFullScreen(True)
In order to indicate activity, some applications (e.g. Pidgin) highlight their entry in GNOME's Window List panel widget (e.g. via bold font or flashing color). This indication is reset automatically when the window is activated.
I have a terminal application for which I would like to achieve the same thing (preferably via Perl, but Python would work too) - but I have no idea where to start. I imagine I'd first have to find the terminal window (based on window title) and then trigger some kind of GTK action.
Any help would be greatly appreciated!
In a GTK application, use gtk_window_set_urgency_hint(). If you have a terminal application, you can't really do that - with libwnck you can get information about other application's windows, but as far as I know you can't get a GtkWindow pointer to another application's window.
May I suggest using the terminal beep? Of course this isn't a sure way to attract the user's attention, but some terminals are able to flash the title bar instead of beeping, or such things.
I'm not really into GTK programming, but as far as i know you want to set an "URGENT"-Flag for the Window which should be highlighted. Maybe this will get you any further. :)