当前位置: 首页>>代码示例>>Python>>正文


Python Windows类代码示例

本文整理汇总了Python中Windows的典型用法代码示例。如果您正苦于以下问题:Python Windows类的具体用法?Python Windows怎么用?Python Windows使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Windows类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: calc_freq

def calc_freq(date_from,date_to,window_size,wanted_list,n,search=[]):
    groups,wanted_list = group(wanted_list)
    # list of tuples of dates
    all_dates = Windows.get_dates(date_from,date_to,365)  # these are not windows, smaller problems
    # for dates and frequencies
    x = []
    y = np.empty((len(wanted_list), 0)).tolist()
    stevec = 0
    print('grem v zanke')
    for tup in all_dates:
        print('leto')
        windows, time = Windows.get_windows(tup[0], tup[1], window_size,search)
        print('windows')
        x += time
        if n==1: grams = count_words(wanted_list,windows)
        else: grams, words_per_window = N_grams.list_of_ngrams(windows, n)
        print('ngrami narjeni')
        for count, i in enumerate(grams):
            #words = words_per_window[count]  #to calculate frequency
            #besede.append(words)
            words =  besede[stevec]
            stevec+=1
            for j,wanted in enumerate(wanted_list):
                frequency = 0
                if wanted in i:
                    frequency = i[wanted] / words
                y[j].append(frequency)
        
        print('ngrami presteti')
    #print(besede)
    print('plotam')
    #print(x,y,wanted_list,groups)
            
    plot(x,y,wanted_list,groups)
    return x,y
开发者ID:zadnjipuki,项目名称:Analiza-spletnih-novic,代码行数:35,代码来源:Timeline.py

示例2: execute

    def execute(self, really_delete):
        """Execute the Windows registry cleaner"""
        if 'nt' != os.name:
            raise StopIteration
        _str = None  # string representation
        ret = None  # return value meaning 'deleted' or 'delete-able'
        if self.valuename:
            _str = '%s<%s>' % (self.keyname, self.valuename)
            ret = Windows.delete_registry_value(self.keyname,
                                                self.valuename, really_delete)
        else:
            ret = Windows.delete_registry_key(self.keyname, really_delete)
            _str = self.keyname
        if not ret:
            # Nothing to delete or nothing was deleted.  This return
            # makes the auto-hide feature work nicely.
            raise StopIteration

        ret = {
            'label': _('Delete registry key'),
            'n_deleted': 0,
            'n_special': 1,
            'path': _str,
            'size': 0}

        yield ret
开发者ID:AlphaPo325,项目名称:bleachbit,代码行数:26,代码来源:Command.py

示例3: __init__

 def __init__(self, uac=True, shred_paths=None):
     if uac and 'nt' == os.name and Windows.elevate_privileges():
         # privileges escalated in other process
         sys.exit(0)
     import RecognizeCleanerML
     RecognizeCleanerML.RecognizeCleanerML()
     register_cleaners()
     self.create_window()
     gobject.threads_init()
     if shred_paths:
         self.shred_paths(shred_paths)
         return
     if options.get("first_start") and 'posix' == os.name:
         pref = PreferencesDialog(self.window, self.cb_refresh_operations)
         pref.run()
         options.set('first_start', False)
     if online_update_notification_enabled and options.get("check_online_updates"):
         self.check_online_updates()
     if 'nt' == os.name:
         # BitDefender false positive.  BitDefender didn't mark BleachBit as infected or show
         # anything in its log, but sqlite would fail to import unless BitDefender was in "game mode."
         # http://bleachbit.sourceforge.net/forum/074-fails-errors
         try:
             import sqlite3
         except ImportError, e:
             print e
             print dir(e)
             self.append_text(
                 _("Error loading the SQLite module: the antivirus software may be blocking it."), 'error')
开发者ID:codesomniare,项目名称:bleachbit,代码行数:29,代码来源:GUI.py

示例4: browse_folder

def browse_folder(parent, title, multiple, stock_button):
    """Ask the user to select a folder.  Return the full path or None."""

    if 'nt' == os.name and None == os.getenv('BB_NATIVE'):
        ret = Windows.browse_folder(
            parent.window.handle if parent else None, title)
        return [ret] if multiple and not ret is None else ret

    # fall back to GTK+
    chooser = gtk.FileChooserDialog(parent=parent,
                                    title=title,
                                    buttons=(
                                        gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                    stock_button, gtk.RESPONSE_OK),
                                    action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
    chooser.set_select_multiple(multiple)
    chooser.set_current_folder(os.path.expanduser('~'))
    resp = chooser.run()
    if multiple:
        ret = chooser.get_filenames()
    else:
        ret = chooser.get_filename()
    chooser.hide()
    chooser.destroy()
    if gtk.RESPONSE_OK != resp:
        # user cancelled
        return None
    return ret
开发者ID:AlphaPo325,项目名称:bleachbit,代码行数:28,代码来源:GuiBasic.py

示例5: detectos

def detectos(required_ver, mock=False):
    """Returns boolean whether the detectos is compatible with the
    current operating system, or the mock version, if given."""
    # Do not compare as string because Windows 10 (build 10.0) comes after
    # Windows 8.1 (build 6.3).
    assert(isinstance(required_ver, (str, unicode)))
    current_os = (mock if mock else Windows.parse_windows_build())
    required_ver = required_ver.strip()
    if required_ver.startswith('|'):
        # This is the maximum version
        # For example, |5.1 means Windows XP (5.1) but not Vista (6.0)
        return current_os <= Windows.parse_windows_build(required_ver[1:])
    elif required_ver.endswith('|'):
        # This is the minimum version
        # For example, 6.1| means Windows 7 or later
        return current_os >= Windows.parse_windows_build(required_ver[:-1])
    else:
        # Exact version
        return Windows.parse_windows_build(required_ver) == current_os
开发者ID:AlphaPo325,项目名称:bleachbit,代码行数:19,代码来源:Winapp.py

示例6: execute

    def execute(self, really_delete):
        """Execute the Windows registry cleaner"""
        if "nt" != os.name:
            raise StopIteration
        _str = None  # string representation
        ret = None  # return value meaning 'deleted' or 'delete-able'
        if self.valuename:
            _str = "%s<%s>" % (self.keyname, self.valuename)
            ret = Windows.delete_registry_value(self.keyname, self.valuename, really_delete)
        else:
            ret = Windows.delete_registry_key(self.keyname, really_delete)
            _str = self.keyname
        if not ret:
            # Nothing to delete or nothing was deleted.  This return
            # makes the auto-hide feature work nicely.
            raise StopIteration

        ret = {"label": _("Delete registry key"), "n_deleted": 0, "n_special": 1, "path": _str, "size": 0}

        yield ret
开发者ID:ihewitt,项目名称:bleachbit,代码行数:20,代码来源:Command.py

示例7: browse_file

def browse_file(parent, title):
    """Prompt user to select a single file"""

    if 'nt' == os.name and None == os.getenv('BB_NATIVE'):
        return Windows.browse_file(parent.window.handle, title)

    chooser = gtk.FileChooserDialog(title=title,
                                    parent=parent,
                                    action=gtk.FILE_CHOOSER_ACTION_OPEN,
                                    buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, gtk.STOCK_OPEN, gtk.RESPONSE_OK))
    chooser.set_current_folder(os.path.expanduser('~'))
    resp = chooser.run()
    path = chooser.get_filename()
    chooser.destroy()

    if gtk.RESPONSE_OK != resp:
        # user cancelled
        return None

    return path
开发者ID:AlphaPo325,项目名称:bleachbit,代码行数:20,代码来源:GuiBasic.py

示例8: is_running

 def is_running(self):
     """Return whether the program is currently running"""
     for running in self.running:
         test = running[0]
         pathname = running[1]
         if 'exe' == test and 'posix' == os.name:
             if Unix.is_running(pathname):
                 print "debug: process '%s' is running" % pathname
                 return True
         elif 'exe' == test and 'nt' == os.name:
             if Windows.is_process_running(pathname):
                 print "debug: process '%s' is running" % pathname
                 return True
         elif 'pathname' == test:
             expanded = os.path.expanduser(os.path.expandvars(pathname))
             for globbed in glob.iglob(expanded):
                 if os.path.exists(globbed):
                     print "debug: file '%s' exists indicating '%s' is running" % (globbed, self.name)
                     return True
         else:
             raise RuntimeError("Unknown running-detection test '%s'" % test)
     return False
开发者ID:hotelzululima,项目名称:bleachbit,代码行数:22,代码来源:Cleaner.py

示例9: __init__

    def __init__(self):
        print "INIT GAME"
    #**************************** основное window
        self.win_width = 1024#Ширина создаваемого окна
        self.win_height = 700# Высота
        self.win_display = (self.win_width,self.win_height)# Группируем ширину и высоту в одну переменную
        self.timer = pygame.time.Clock()
        self.online = True
    #**************************** инициализация

        self.left = self.right = self.up = self.down = self.space = False
        self.exit_ = True# флаг для выхода
        self.windows = Windows()# инициализируем Windows
        self.player = Player((100,100))# инициализируем Tank
        #self.bul = self.player.shot_bull()
        self.level1 = Level('level1.txt')#Инициализируем level1
        self.level1.load_level()
        self.platforms = self.level1.ret_tiles()

#******************************* свойства для сетевого взаимодействия
        self.id = None
        self.data = {}
        self.data['type'] = 'game'
        self.data['shoot'] = False
        self.move_coord = (0,0,0,0)
        self.stop_coord = (0,0,0,0)

    #**************************** блоки спрайтов

        self.block_list = pygame.sprite.Group() #Это список спрайтов. Каждый блок добавляется в этот список.
        self.all_sprites_list = pygame.sprite.Group()# # Это список каждого спрайта. Все блоки, а также блок игрока.
        self.bullet_list = pygame.sprite.Group()#тес массив спрайтов пули

        self.block_list.add(self.platforms)
        self.all_sprites_list.add(self.player)

        self.cf = ClientConnFactory(self)
        reactor.connectTCP(HOST,PORT,self.cf)
        reactor.run()
开发者ID:Oleksandr1,项目名称:tank,代码行数:39,代码来源:Game.py

示例10: emptyrecyclebin

 def emptyrecyclebin():
     return Windows.empty_recycle_bin(drive, True)
开发者ID:dthiago,项目名称:bleachbit,代码行数:2,代码来源:Cleaner.py

示例11: get_commands

    def get_commands(self, option_id):
        # This variable will collect fully expanded file names, and
        # at the end of this function, they will be checked they exist
        # and processed through Command.Delete().
        files = []

        # cache
        if 'posix' == os.name and 'cache' == option_id:
            dirname = os.path.expanduser("~/.cache/")
            for filename in children_in_directory(dirname, True):
                if self.whitelisted(filename):
                    continue
                files += [filename]

        # custom
        if 'custom' == option_id:
            for (c_type, c_path) in options.get_custom_paths():
                if 'file' == c_type:
                    files += [c_path]
                elif 'folder' == c_type:
                    files += [c_path]
                    for path in children_in_directory(c_path, True):
                        files += [path]
                else:
                    raise RuntimeError(
                        'custom folder has invalid type %s' % c_type)

        # menu
        menu_dirs = ['~/.local/share/applications',
                     '~/.config/autostart',
                     '~/.gnome/apps/',
                     '~/.gnome2/panel2.d/default/launchers',
                     '~/.gnome2/vfolders/applications/',
                     '~/.kde/share/apps/RecentDocuments/',
                     '~/.kde/share/mimelnk',
                     '~/.kde/share/mimelnk/application/ram.desktop',
                     '~/.kde2/share/mimelnk/application/',
                     '~/.kde2/share/applnk']

        if 'posix' == os.name and 'desktop_entry' == option_id:
            for dirname in menu_dirs:
                for filename in [fn for fn in children_in_directory(dirname, False)
                                 if fn.endswith('.desktop')]:
                    if Unix.is_broken_xdg_desktop(filename):
                        yield Command.Delete(filename)

        # unwanted locales
        if 'posix' == os.name and 'localizations' == option_id:
            callback = lambda locale, language: options.get_language(language)
            for path in Unix.locales.localization_paths(callback):
                yield Command.Delete(path)

        # Windows logs
        if 'nt' == os.name and 'logs' == option_id:
            paths = (
                '$ALLUSERSPROFILE\\Application Data\\Microsoft\\Dr Watson\\*.log',
                '$ALLUSERSPROFILE\\Application Data\\Microsoft\\Dr Watson\\user.dmp',
                '$LocalAppData\\Microsoft\\Windows\\WER\\ReportArchive\\*\\*',
                '$LocalAppData\\Microsoft\\Windows\WER\\ReportQueue\\*\\*',
                '$programdata\\Microsoft\\Windows\\WER\\ReportArchive\\*\\*',
                '$programdata\\Microsoft\\Windows\\WER\\ReportQueue\\*\\*',
                '$localappdata\\Microsoft\\Internet Explorer\\brndlog.bak',
                '$localappdata\\Microsoft\\Internet Explorer\\brndlog.txt',
                '$windir\\*.log',
                '$windir\\imsins.BAK',
                '$windir\\OEWABLog.txt',
                '$windir\\SchedLgU.txt',
                '$windir\\ntbtlog.txt',
                '$windir\\setuplog.txt',
                '$windir\\REGLOCS.OLD',
                '$windir\\Debug\\*.log',
                '$windir\\Debug\\Setup\\UpdSh.log',
                '$windir\\Debug\\UserMode\\*.log',
                '$windir\\Debug\\UserMode\\ChkAcc.bak',
                '$windir\\Debug\\UserMode\\userenv.bak',
                '$windir\\Microsoft.NET\Framework\*\*.log',
                '$windir\\pchealth\\helpctr\\Logs\\hcupdate.log',
                '$windir\\security\\logs\\*.log',
                '$windir\\security\\logs\\*.old',
                '$windir\\system32\\TZLog.log',
                '$windir\\system32\\config\\systemprofile\\Application Data\\Microsoft\\Internet Explorer\\brndlog.bak',
                '$windir\\system32\\config\\systemprofile\\Application Data\\Microsoft\\Internet Explorer\\brndlog.txt',
                '$windir\\system32\\LogFiles\\AIT\\AitEventLog.etl.???',
                '$windir\\system32\\LogFiles\\Firewall\\pfirewall.log*',
                '$windir\\system32\\LogFiles\\Scm\\SCM.EVM*',
                '$windir\\system32\\LogFiles\\WMI\\Terminal*.etl',
                '$windir\\system32\\LogFiles\\WMI\\RTBackup\EtwRT.*etl',
                '$windir\\system32\\wbem\\Logs\\*.lo_',
                '$windir\\system32\\wbem\\Logs\\*.log', )

            for path in paths:
                expanded = os.path.expandvars(path)
                for globbed in glob.iglob(expanded):
                    files += [globbed]

        # memory
        if sys.platform.startswith('linux') and 'memory' == option_id:
            yield Command.Function(None, Memory.wipe_memory, _('Memory'))

        # memory dump
#.........这里部分代码省略.........
开发者ID:dthiago,项目名称:bleachbit,代码行数:101,代码来源:Cleaner.py

示例12: handle_section

 def handle_section(self, section):
     """Parse a section"""
     def detect_file(rawpath):
         pathname = os.path.expandvars(preexpand(rawpath))
         return os.path.exists(pathname)
     # if simple detection fails then discard the section
     if self.parser.has_option(section, 'detect'):
         key = self.parser.get(section, 'detect')
         if not Windows.detect_registry_key(key):
             return
     if self.parser.has_option(section, 'detectfile'):
         if not detect_file(self.parser.get(section, 'detectfile')):
             return
     if self.parser.has_option(section, 'detectos'):
         required_ver = self.parser.get(section, 'detectos')
         if not detectos(required_ver):
             return
     # in case of multiple detection, discard if none match
     if self.parser.has_option(section, 'detectfile1'):
         matches = 0
         for n in range(1, MAX_DETECT):
             option_id = 'detectfile%d' % n
             if self.parser.has_option(section, option_id):
                 if detect_file(self.parser.get(section, option_id)):
                     matches = matches + 1
         if 0 == matches:
             return
     if self.parser.has_option(section, 'detect1'):
         matches = 0
         for n in range(1, MAX_DETECT):
             option_id = 'detect%d' % n
             if self.parser.has_option(section, option_id):
                 if Windows.detect_registry_key(self.parser.get(section, option_id)):
                     matches = matches + 1
         if 0 == matches:
             return
     # not yet implemented
     if self.parser.has_option(section, 'excludekey'):
         print 'ERROR: ExcludeKey not implemented, section=', section
         return
     # there are two ways to specify sections: langsecref= and section=
     if self.parser.has_option(section, 'langsecref'):
         # verify the langsecref number is known
         # langsecref_num is 3021, games, etc.
         langsecref_num = self.parser.get(section, 'langsecref')
     elif self.parser.has_option(section, 'section'):
         langsecref_num = self.parser.get(section, 'section')
     else:
         print 'ERROR: neither option LangSecRef nor Section found in section %s' % (section)
         return
     # find the BleachBit internal cleaner ID
     lid = self.section_to_cleanerid(langsecref_num)
     self.cleaners[lid].add_option(
         section2option(section), section.replace('*', ''), '')
     for option in self.parser.options(section):
         if option.startswith('filekey'):
             self.handle_filekey(lid, section, option)
         elif option.startswith('regkey'):
             self.handle_regkey(lid, section, option)
         elif option == 'warning':
             self.cleaners[lid].set_warning(
                 section2option(section), self.parser.get(section, 'warning'))
         elif option in ('default', 'detectfile', 'detect', 'langsecref', 'section') \
             or ['detect%d' % x for x in range(1, MAX_DETECT)] \
                 or ['detectfile%d' % x for x in range(1, MAX_DETECT)]:
             pass
         else:
             print 'WARNING: unknown option %s in section %s' % (option, section)
             return
开发者ID:jun-zhang,项目名称:bleachbit,代码行数:69,代码来源:Winapp.py

示例13: get_commands

    def get_commands(self, option_id):
        # This variable will collect fully expanded file names, and
        # at the end of this function, they will be checked they exist
        # and processed through Command.Delete().
        files = []

        # cache
        if "posix" == os.name and "cache" == option_id:
            dirname = os.path.expanduser("~/.cache/")
            for filename in children_in_directory(dirname, True):
                if self.whitelisted(filename):
                    continue
                files += [filename]

        # custom
        if "custom" == option_id:
            for (c_type, c_path) in options.get_custom_paths():
                if "file" == c_type:
                    files += [c_path]
                elif "folder" == c_type:
                    files += [c_path]
                    for path in children_in_directory(c_path, True):
                        files += [path]
                else:
                    raise RuntimeError("custom folder has invalid type %s" % c_type)

        # menu
        menu_dirs = [
            "~/.local/share/applications",
            "~/.config/autostart",
            "~/.gnome/apps/",
            "~/.gnome2/panel2.d/default/launchers",
            "~/.gnome2/vfolders/applications/",
            "~/.kde/share/apps/RecentDocuments/",
            "~/.kde/share/mimelnk",
            "~/.kde/share/mimelnk/application/ram.desktop",
            "~/.kde2/share/mimelnk/application/",
            "~/.kde2/share/applnk",
        ]

        if "posix" == os.name and "desktop_entry" == option_id:
            for dirname in menu_dirs:
                for filename in [fn for fn in children_in_directory(dirname, False) if fn.endswith(".desktop")]:
                    if Unix.is_broken_xdg_desktop(filename):
                        yield Command.Delete(filename)

        # unwanted locales
        if "posix" == os.name and "localizations" == option_id:
            for path in Unix.locales.localization_paths(locales_to_keep=options.get_languages()):
                if os.path.isdir(path):
                    for f in FileUtilities.children_in_directory(path, True):
                        yield Command.Delete(f)
                yield Command.Delete(path)

        # Windows logs
        if "nt" == os.name and "logs" == option_id:
            paths = (
                "$ALLUSERSPROFILE\\Application Data\\Microsoft\\Dr Watson\\*.log",
                "$ALLUSERSPROFILE\\Application Data\\Microsoft\\Dr Watson\\user.dmp",
                "$LocalAppData\\Microsoft\\Windows\\WER\\ReportArchive\\*\\*",
                "$LocalAppData\\Microsoft\\Windows\WER\\ReportQueue\\*\\*",
                "$programdata\\Microsoft\\Windows\\WER\\ReportArchive\\*\\*",
                "$programdata\\Microsoft\\Windows\\WER\\ReportQueue\\*\\*",
                "$localappdata\\Microsoft\\Internet Explorer\\brndlog.bak",
                "$localappdata\\Microsoft\\Internet Explorer\\brndlog.txt",
                "$windir\\*.log",
                "$windir\\imsins.BAK",
                "$windir\\OEWABLog.txt",
                "$windir\\SchedLgU.txt",
                "$windir\\ntbtlog.txt",
                "$windir\\setuplog.txt",
                "$windir\\REGLOCS.OLD",
                "$windir\\Debug\\*.log",
                "$windir\\Debug\\Setup\\UpdSh.log",
                "$windir\\Debug\\UserMode\\*.log",
                "$windir\\Debug\\UserMode\\ChkAcc.bak",
                "$windir\\Debug\\UserMode\\userenv.bak",
                "$windir\\Microsoft.NET\Framework\*\*.log",
                "$windir\\pchealth\\helpctr\\Logs\\hcupdate.log",
                "$windir\\security\\logs\\*.log",
                "$windir\\security\\logs\\*.old",
                "$windir\\SoftwareDistribution\\*.log",
                "$windir\\SoftwareDistribution\\DataStore\\Logs\\*",
                "$windir\\system32\\TZLog.log",
                "$windir\\system32\\config\\systemprofile\\Application Data\\Microsoft\\Internet Explorer\\brndlog.bak",
                "$windir\\system32\\config\\systemprofile\\Application Data\\Microsoft\\Internet Explorer\\brndlog.txt",
                "$windir\\system32\\LogFiles\\AIT\\AitEventLog.etl.???",
                "$windir\\system32\\LogFiles\\Firewall\\pfirewall.log*",
                "$windir\\system32\\LogFiles\\Scm\\SCM.EVM*",
                "$windir\\system32\\LogFiles\\WMI\\Terminal*.etl",
                "$windir\\system32\\LogFiles\\WMI\\RTBackup\EtwRT.*etl",
                "$windir\\system32\\wbem\\Logs\\*.lo_",
                "$windir\\system32\\wbem\\Logs\\*.log",
            )

            for path in paths:
                expanded = os.path.expandvars(path)
                for globbed in glob.iglob(expanded):
                    files += [globbed]

#.........这里部分代码省略.........
开发者ID:ihewitt,项目名称:bleachbit,代码行数:101,代码来源:Cleaner.py

示例14: Game

class Game():
    def __init__(self):
        print "INIT GAME"
    #**************************** основное window
        self.win_width = 1024#Ширина создаваемого окна
        self.win_height = 700# Высота
        self.win_display = (self.win_width,self.win_height)# Группируем ширину и высоту в одну переменную
        self.timer = pygame.time.Clock()
        self.online = True
    #**************************** инициализация

        self.left = self.right = self.up = self.down = self.space = False
        self.exit_ = True# флаг для выхода
        self.windows = Windows()# инициализируем Windows
        self.player = Player((100,100))# инициализируем Tank
        #self.bul = self.player.shot_bull()
        self.level1 = Level('level1.txt')#Инициализируем level1
        self.level1.load_level()
        self.platforms = self.level1.ret_tiles()

#******************************* свойства для сетевого взаимодействия
        self.id = None
        self.data = {}
        self.data['type'] = 'game'
        self.data['shoot'] = False
        self.move_coord = (0,0,0,0)
        self.stop_coord = (0,0,0,0)

    #**************************** блоки спрайтов

        self.block_list = pygame.sprite.Group() #Это список спрайтов. Каждый блок добавляется в этот список.
        self.all_sprites_list = pygame.sprite.Group()# # Это список каждого спрайта. Все блоки, а также блок игрока.
        self.bullet_list = pygame.sprite.Group()#тес массив спрайтов пули

        self.block_list.add(self.platforms)
        self.all_sprites_list.add(self.player)

        self.cf = ClientConnFactory(self)
        reactor.connectTCP(HOST,PORT,self.cf)
        reactor.run()
    #****************************инициализируем pygame (получаем screen)
    def init_window(self):
        pygame.init()#инициализируем pygame
        self.screen = pygame.display.set_mode(self.win_display)# Создаем окошко
        pygame.display.set_caption('Tanks')#название шапки "капчи"

    #****************************обработка процессов и действий (обработка нажатий (mouse and keyboard и др.))
    def tick(self):
        self.timer.tick(60)
    #****************************обработка
        for event in pygame.event.get():
            if event.type == KEYDOWN and event.key == K_LEFT:
                self.left = True

                #self.sendData("left = True")
                self.data['coordinate'] = (1,0,0,0)
                self.sendData(self.data)
            if event.type == KEYUP and event.key == K_LEFT:
                self.left = False
                self.data['coordinate'] = self.stop_coord
                self.sendData(self.data)

            if event.type == KEYDOWN and event.key == K_RIGHT:
                self.right = True
                #self.sendData('self.right = True')
                self.data['coordinate'] = (0,1,0,0)
                self.sendData(self.data)

            if event.type == KEYUP and event.key == K_RIGHT:
                self.right = False
                #self.sendData('self.right = False')
                self.data['coordinate'] = self.stop_coord
                self.sendData(self.data)


            if event.type == KEYDOWN and event.key == K_UP:
                self.up = True
                #self.sendData('self.up = True')
                self.data['coordinate'] = (0,0,1,0)
                self.sendData(self.data)

            if event.type == KEYUP and event.key == K_UP:
                self.up = False
                #self.sendData('self.up = False')
                self.data['coordinate'] = self.stop_coord
                self.sendData(self.data)


            if event.type == KEYDOWN and event.key == K_DOWN:
                self.down = True
                self.data['coordinate'] = (0,0,0,1)
                self.sendData(self.data)

                #self.sendData('self.down = True')
            if event.type == KEYUP and event.key == K_DOWN:
                self.down = False
                #self.sendData('self.down = False')
                self.data['coordinate'] = self.stop_coord
                self.sendData(self.data)

#.........这里部分代码省略.........
开发者ID:Oleksandr1,项目名称:tank,代码行数:101,代码来源:Game.py

示例15: greet

def greet(sender):
    Windows.alert("Hello AJAX!")
开发者ID:Afey,项目名称:pyjs,代码行数:2,代码来源:test014.py


注:本文中的Windows类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。