當前位置: 首頁>>代碼示例>>Python>>正文


Python Keyboard.flush方法代碼示例

本文整理匯總了Python中keyboard.Keyboard.flush方法的典型用法代碼示例。如果您正苦於以下問題:Python Keyboard.flush方法的具體用法?Python Keyboard.flush怎麽用?Python Keyboard.flush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在keyboard.Keyboard的用法示例。


在下文中一共展示了Keyboard.flush方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: dispense_and_scan

# 需要導入模塊: from keyboard import Keyboard [as 別名]
# 或者: from keyboard.Keyboard import flush [as 別名]
 def dispense_and_scan(self, author_selection):
     j = 0
     #f = open(self.dispenserDevices[0], "wb")
     f = open("/dev/ttyUSB0", "wb")
     f.write("020180000380".decode("hex"))
     f.flush()
     f.close()
     #k = Keyboard(self.scannerKeyDev[0])
     k = Keyboard("/dev/input/event0")
     k.flush()
     code = ""
     i = 0
     #return code
     start_time = time.time()
     while i < 8:
         key = k.readKey()
         #print key
         if key is not None:
             code += key
             i += 1
         end_time = time.time() - start_time 
         #self.write_log("end time = "+str(end_time))
         if(end_time > 4):
             self.write_log("reader time out!!")
             break;
     self.write_log("Dispensing from card dispenser " + str(0))
     self.write_log("device = "+str(self.dispenserDevices[0]))
     self.write_log("scanner device = "+str(self.scannerKeyDev[0]))
     return code
開發者ID:pierrep,項目名稱:dialastory,代碼行數:31,代碼來源:puffin_sm.py


注:本文中的keyboard.Keyboard.flush方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。