right mouse click with python

Reply

Join Date: May 2008
Posts: 1
Reputation: micam is an unknown quantity at this point 
Solved Threads: 0
micam micam is offline Offline
Newbie Poster

right mouse click with python

 
0
  #1
May 3rd, 2008
Hi,

How can I send right nouse click with python?

thanks.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,003
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 928
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: right mouse click with python

 
0
  #2
May 3rd, 2008
You need to make this a GUI program ...
  1. # bind mouse clicks using the Tkinter GUI toolkit
  2. # (usually included in your Python installation)
  3.  
  4. import Tkinter as tk
  5.  
  6. def change_color(event):
  7. btn1.config(fg='red')
  8.  
  9. root = tk.Tk()
  10. btn1 = tk.Button(root, text='Click me with the right mouse button ...')
  11. btn1.pack()
  12.  
  13. btn1.bind('<Button-3>', change_color) # bind right mouse click
  14.  
  15. root.mainloop()
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC