mouseevent

Python Tkinter: Canvas scrolling with MouseWheel

主宰稳场 提交于 2019-12-01 08:57:23
问题 I have created a tree inside a Canvas, and I have also allowed MouseWheel to scroll up and down. However, how do I prevent scrolling if tree content has not exceed canvas size? (Tree content can possibly exceed canvas size by expanding) Please run the following code: from Tkinter import Tk, Frame, BOTH, Canvas from xml.dom.minidom import parseString from idlelib.TreeWidget import TreeItem, TreeNode class DomTreeItem(TreeItem): def __init__(self, node): self.node = node def GetText(self): node

How can I make Robot press and hold a mouse button for a certain period of time?

血红的双手。 提交于 2019-12-01 08:20:05
I am using Java to generate a mouse press using the Robot class: robot.mousePress(InputEvent.BUTTON1_MASK); robot.mouseRelease(InputEvent.BUTTON1_MASK); However, I want the Robot to press the button for a certain period of time. How can I achieve this? Just sleep a bit between the two actions (specified in milliseconds): Thread.sleep(long millis); robot.mousePress(InputEvent.BUTTON1_MASK); try { Thread.sleep(1000); } catch(Exception e) {} // Click one second robot.mouseRelease(InputEvent.BUTTON1_MASK); Robot.delay(long millis); robot.mousePress(InputEvent.BUTTON1_MASK); robot.delay(1000); //

Not catching all mouse events with wxWidgets

时光毁灭记忆、已成空白 提交于 2019-12-01 08:15:46
问题 Hi I am am trying to catch mouse movements for a MouseOver function in an app created with Code::Blocks using the wxSmith plugin. I have stumbled upon a puzzling problem. EVT_MOUSEWHEEL calling the function in the EventTable works well, but all other macros have no result at all. And the mousewheel is not really want I want (I just used it to test...) This is for Windows. Here is a the basic problem code (mostly generated by the fantastic wxSmith plugin) MouseMain.h #include <wx/frame.h>

“Cannot convert string to ImageSource.” How can I do this?

流过昼夜 提交于 2019-12-01 06:38:58
private void HeroMouseEnter(object sender, MouseEventArgs e) { ((Image)sender).Source = GetGlowingImage(((Image)sender).Name); } public ImageSource GetGlowingImage(string name) { switch (name) { case "Andromeda": return "HeroGlowIcons/64px-Andromeda.gif"; default: return null; } } I'm just trying to make an event to change the image according to where the mouse entered. But I cannot make this work. Edit: I did this in Windows Forms and it work 100% like I want it to. How could I translate something like this in WPF? void HeroMouseEnter(object sender, EventArgs e) { ((PictureBox)sender).Image =

Python tkinter label widget mouse over

蹲街弑〆低调 提交于 2019-12-01 06:38:16
My objective is to change the text of label widget when the mouse move over the label.For one label i would do something like this: import Tkinter as tk def fun1(event): label.config(text="Haha") def fun2(event): label.config(text="Label1") root=tk.Tk() label=tk.Label(root,text="Label1") label.grid(row=1,column=1) label.bind("<Enter>", fun1) label.bind("<Leave>", fun2) root.mainloop() But now, i have a bunch of labels which is generated by for loop and a list which contains the text that i want to change. mylist=['a','b','c','d','e'] for i in range(5): tk.Label(root,text="Label"+str(i)).grid

Is it possible to inspect DOM modifications as they happen? [duplicate]

て烟熏妆下的殇ゞ 提交于 2019-12-01 06:25:34
This question already has an answer here: Find what javascript changes the DOM? 2 answers I'm trying to look at the html produced by a jQuery tooltip plugin (qTip v1). The tooltip only appears when I hover over the element with my mouse pointer. Normally I'd just inspect the html or dig deeper with Chrome's developer console, but as soon as I do that the tooltip disappears because the mouseover event ends. The tooltip's position is outside the normal flow of the document so I can't set up the Elements tab (Chrome) easily to view it as it's happening. Is there a method in any browser that

jquery menu hovering

一个人想着一个人 提交于 2019-12-01 06:05:55
i have a menu that when i mouse over a div it will show and on mouse out it will fade out. the problem is that if you roll over any of the menu's children the menu will disappear(because technically if you're over one of the children then you're not over the parent) is there a way so that rolling over the children will not count as a mouseout? here is my code: http://jsfiddle.net/32bLg/ This is a very simple problem most people tend to massively overcomplicate with timers and special case checks. The easy solution is via markup. Place both hover target and the menu under the same parent, and

eventFilter on a QWidget with PyQt4

别等时光非礼了梦想. 提交于 2019-12-01 05:59:00
问题 I have a QMainWindow which contains a DrawingPointsWidget . This widget draws red points randomly. I display the mouse coordinates in the QMainWindow's status bar by installing an event filter for the MouseHovering event using self.installEventFilter(self) and by implementing the eventFilter() method . It works. However I want to get the mouse coordinates on this red-points widget, and not on the QMainWindow. So I want the status bar to display [0, 0] when the mouse is at the top-left corner

Python tkinter label widget mouse over

此生再无相见时 提交于 2019-12-01 05:34:14
问题 My objective is to change the text of label widget when the mouse move over the label.For one label i would do something like this: import Tkinter as tk def fun1(event): label.config(text="Haha") def fun2(event): label.config(text="Label1") root=tk.Tk() label=tk.Label(root,text="Label1") label.grid(row=1,column=1) label.bind("<Enter>", fun1) label.bind("<Leave>", fun2) root.mainloop() But now, i have a bunch of labels which is generated by for loop and a list which contains the text that i

How to programmatically fire a MouseEvent to a MouseListener with Java?

痴心易碎 提交于 2019-12-01 05:15:35
I have a JTree with a custom associated MouseListener (for showing popup etc.). I need to fire a MouseEvent that will be caught by the MouseListener . How should I do that programmatically? You could create your own MouseEvent and loop through all the listeners and make the call. For example: MouseEvent me = new MouseEvent(tree, 0, 0, 0, 100, 100, 1, false); for(MouseListener ml: tree.getMouseListeners()){ ml.mousePressed(me); } The Robot class might be what you're looking for. This class is used to generate native system input events for the purposes of test automation, self-running demos,