Beispiel #1
0
 def get_balance(self):
     hot_key(['F4'])
     time.sleep(sleep_time)
     self.refresh()
     hwnd = self.get_right_hwnd()
     result = {}
     for key, cid in BALANCE_CONTROL_ID_GROUP.items():
         ctrl = win32gui.GetDlgItem(hwnd, cid)
         result[key] = get_text(ctrl)
     return result
Beispiel #2
0
 def get_balance(self):
     hot_key(['F4'])
     time.sleep(sleep_time)
     self.refresh()
     hwnd = self.get_right_hwnd()
     data = {}
     for key, cid in BALANCE_CONTROL_ID_GROUP.items():
         ctrl = win32gui.GetDlgItem(hwnd, cid)
         data[key] = get_text(ctrl)
     return {
         'code': 0, 'status': 'succeed',
         'data': data,
     }
Beispiel #3
0
    def get_balance(self):

        self.__select_menu(['查询[F4]', '资金股票'])
        result = {}
        for key, control_id in BALANCE_CONTROL_ID_GROUP.items():
            retry = 0
            while retry < 10:
                try:
                    result[key] = float(
                        self.main_wnd.window(
                            control_id=control_id,
                            class_name='Static').window_text())
                    retry = 10
                except:
                    time.sleep(0.1)
                    retry += 1
                    print("重试第%d次" % (retry))

        return result