PyGTK "assertion GTK_IS_WINDOW failed - python

I'm trying to build a web browser using PyGTK and PyWebKit
However, I'm pretty sure my question only concerns PyGTK
I have a custom gtk.Notebook class, with an "add tab" button as the last tab.
When I click it, it gives me the error
/home/ruiqimao/workspace/PyBrowser/src/browser/__init__.py:161: GtkWarning: IA__gdk_window_get_cursor: assertion `GDK_IS_WINDOW (window)' failed gtk.main()
twice.
And then, my new tab won't show up.
I have no idea what is going on, so here is my whole code
If any of you could help me, that would be great!
Thanks!
[EDIT]: Just found out that the problem lies in the w.show_all() line
What could this mean?

This question has been sitting in "unanswered" for months, without any answer. However, the problem was indeed solved (see comments). Thus, as a service to get this question OUT of "unanswered", I'll restate the apparent answer. If anyone else can top me, pleeeeeeeease do. :)
You forgot to show the new tab.
Thank you, and goodnight. :)

Related

Anki: Appending New Dropdown Option on MenuBar? (Pycharm, Windows)

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?

Window resolution in Tkinter

I know that this might sound weird, but I have a problem considering the screen resolution of my Tkinter program. I have attached two pictures for a comparison.
I think you can clearly tell, what I'm talking about. The problem is that I don't really know why this happened. Suddenly the tkinter window had a way better resolution as you can see in the top picture. I did not change anything related to screensize/resolution by myself and was therefore expecting Tkinter to have published an update which just has better textures for every widget.
But because I had to reinstall python and all its modules this is no longer the case and the widgets look very blurry again (Bottom picture). Now I'm asking myself whether this has something to do with another version of Python or tkinter I'm using or what else could have been the reason for that.
I did not change my PC, Screen or anything like that. I just reinstalled python and its modules. Sadly I don't have the source code of the version where it looked great, but only an .exe file, because im continuously updating my program. But as I said before, I don't know what I could have changed which led to this huge resolution improvement.
I hope you get, what I'm trying to tell you.
Thanks in advance!
I was able so solve it!
I had a look on this question: on Stackoverflow
The answer from #binaryfunt solved my problem completely. So it was not really a tkinter/python thing, but rather windows itself.

_tkinter.TclError: invalid command name ".entry#"

I've been coding in python using tkinter and came across an exception from the tinter library.
Since I don't know exactly what the error means, it is hard for me to debug my program. I was wondering if someone could outline the error and suggest what may have caused it, so that I know what to look for when debugging my program. _tkinter.TclError: invalid command name ".entry#" (The hash represents a number).
I have an image showing the navigation through my program that causes the error if it helps.
Basically, the program will only let me view a sub-menu in the "record" section once, each time I run it, when it should let me enter them as many times as I need to.
You should include the error as text and not as unreadable image.
Based on the error message, you're trying to call .get() on an Entry that doesn't exist anymore. Maybe the parent window has been destroyed/closed and the entry is not there anymore. Or maybe it is just a context thing... hard to tell without the code.
If you can't figure out, please edit your question and add a MCVE, then I will edit my answer with more specific information.

How to make VLC click through

I have been all over the web looking for a solution to this problem!
I'm looking for a way to make my VLC window "click through" on linux.
I have found some python code here: https://stackoverflow.com/a/11917174/3426514 that says it can solve the problem, but I dont know how to apply that answer to my VLC window.
Is there a way to make a bash script that i can execute after vlc has started that will make the vlc window click-through? Or anything else, like a CCM plugin or a vlc plugin or magic foo?
I'm on ubuntu 14.04 if that is helpful :)
Edit: Another implemetation, part of the notifications code:
https://github.com/dkasak/notify-osd-customizable/blob/master/src/bubble.c#L1608
Edit2: A SVG Implementation, dont think this applies, but it is kinda relevant https://superuser.com/questions/699289/making-cairo-clock-click-through-able-cairo-graphics
Edit3: The used to be a compiz plugin called ghost a long long time ago https://github.com/compiz-reloaded/compiz-plugins-experimental
Edit4: To address the downvote to close: I expect the actual code to do this would be a few lines at most, i just have no clue how to do it. If there is something that I can provide to narrow the focus or provide more information, I will gladly do so.
Edit 5: Another related question. Create a click through window for Linux
You can have VLC write to the desktop background, then set all your app windows to be partially transparent. Output to Background is a VLC option. What you want is backwards from that, where VLC is overlayed on top of everything else, but ignored for user input, however if you don't mind going the other way, it's "already in there" 8-)

Anyway to bring up suggestion box when typing python code

I'm learning wxpython right now and one thing that helps me ALOT is when I'm typing in the text editor I sometimes press the tab key to give me a hint on what I'm looking for...This is great when it works but I notice sometimes it doesn't work and I get lost looking for a syntax I can't remember...
Question is how can I get the suggestion box to pop back up again, Or what am I doing that causes it to stop coming up...
if it matters I backtracked to 2.7 to learn wx, Windows 7
Edit: More specifically... when I type: wx.(Here is normally when I would press tab)
What editor do you use??
Without knowing that there's no way we can possibly help you.
FWIW in vim I use C-x [onp]

Categories

Resources