Python Forum
Getting button pressed number
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting button pressed number
#3
(Dec-13-2020, 05:01 PM)bowlofred Wrote: Probably something like
ser.write(str(xcoord).encode())

Yes. Almost there.
I try with print first and worked.
I need both x and y
so I try

print(str(xcoord).encode(),str(ycoord).encode())
And worked too.
Then I try

ser.write(str(xcoord).encode(),str(ycoord).encode())
And I get


t.callbacks[evt.number](x,y,evt.edge)
ser.write(str(xcoord),encode(),str(ycoord).encode())
TypeError: write() takes 2 positional arguments but 3 were given
Reply


Messages In This Thread
Getting button pressed number - by Moris526 - Dec-13-2020, 04:27 PM
RE: Getting button pressed number - by bowlofred - Dec-13-2020, 05:01 PM
RE: Getting button pressed number - by Moris526 - Dec-13-2020, 05:55 PM
RE: Getting button pressed number - by bowlofred - Dec-13-2020, 08:03 PM
RE: Getting button pressed number - by Moris526 - Dec-14-2020, 01:41 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How many times was the button pressed in pyglet rama27 0 1,978 Oct-10-2020, 10:26 AM
Last Post: rama27
  run different functions each time the same button is pressed? User3000 6 3,455 Jul-31-2020, 11:11 PM
Last Post: User3000
  Terminate a process when hotkey is pressed 66Gramms 0 2,311 Dec-24-2019, 06:41 PM
Last Post: 66Gramms
  Advance program when certain keys are pressed? Chrislw324 2 2,413 May-19-2019, 07:13 PM
Last Post: woooee
  Count to movement according to the time pressed button noartist 1 2,579 Feb-27-2019, 01:33 PM
Last Post: noartist
  What key pressed? ian 2 5,097 Jul-29-2018, 02:30 AM
Last Post: snippsat
  Can't edit code after I've pressed enter. xBlackHeartx 2 12,269 Sep-02-2017, 10:04 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020