Soporte

Habla con gente sobre python en un grupo de skype.
Skype:
hackloper

Python

All created with python

martes, 12 de noviembre de 2013

Posted by HackLoper |
Módulo para poder crear ventanas fácilmente.

PysimpleBox:
# -*- coding: cp1252 -*-

'''
By: HackLoper

version: 1.0
python version: 2.7

blog: http://hackloper.blogspot.com
twiter: https://twitter.com/HackLoper o @HackLoper
youtuve: https://www.youtube.com/user/hackdeveloper
tuenti: HackLoper
gmail: hackloper.soporte@gmail.com
'''

from __future__ import print_function
import ctypes
MSG = ctypes.windll.user32

TYPE_BOX = {'ABORTRETRYIGNORE':0x00000002L,
            'CANCELTRYCONTINUE':0x00000006L,
            'HELP':0x00004000L,
            'OK':0x00000000L,
            'OKCANCEL':0x00000001L,
            'RETRYCANCEL':0x00000005L,
            'YESNO':0x00000004L,
            'YESNOCANCEL':0x00000003L}

ICON = {'ICONEXCLAMATION':0x00000030L,
        'ICONWARNING':0x00000030L,
        'ICONINFORMATION':0x00000040L,
        'ICONASTERISK':0x00000040L,
        'ICONQUESTION':0x00000020L,
        'ICONSTOP':0x00000010L,
        'ICONERROR':0x00000010L,
        'ICONHAND':0x00000010L}

OPTION = {'NORMAL':0x00000000L,
    'PERMANENT':0x00001000L}

REPLY = {3:'ABORT',
         2:'CANCEL',
         11:'CONTINUE',
         5:'IGNORE',
         7:'NO',
         1:'OK',
         4:'RETRY',
         10:'TRYAGAIN',
         6:'YES'}

def show(box='OK',icon='ICONEXCLAMATION',option='NORMAL',title='title',
         text='text'):
    no_str = ();
    cont = 0;
    str_param = ('box','icon','option');
    
    for i in (box,icon,option):
        if isinstance(i,str):
            pass
        else:
            var = str_param[cont];
            no_str = no_str+(var,);
            cont = cont+1;

    if len(no_str)>0:
        cont = len(no_str);
        n = 1;
        print("Them following variables do not contain string: ",end='');
        for v in no_str:
            if n == cont:
                print("%s " %(v),end='');
            else:
                print("%s, " %(v),end='');
                n = n+1;
        print('');
        return
    else:
        msg = MSG.MessageBoxA(None,text,title,
                            (TYPE_BOX[box]|ICON[icon]|OPTION[option]))
        return REPLY[msg]

example:
import PysimpleBox 

box = PysimpleBox.show(box='OKCANCEL',icon='ICONERROR',title='Window',text='mensaje');
print(box);

0 comentarios:

Publicar un comentario