예제 #1
0
 def initialization(s):
     try:
         s.color_background = s.color_background
     except AttributeError:
         s.color_background = 0xffffff
     try:
         s.color_cursor = s.color_cursor
     except AttributeError:
         s.color_cursor = 0xcccccc
     s.icon_size_x = s.icon_size_y = s.images.size[1]
     s.abreast_x = s.layout[0][0] / s.icon_size_x
     s.abreast_layout_y = s.layout[0][1] / s.icon_size_y
     s.distribution_icons = divmod(len(s.list_s), s.abreast_x)
     if s.distribution_icons[1]:
         s.abreast_full_y = s.distribution_icons[0] + 1
     else:
         s.abreast_full_y = s.distribution_icons[0]
     s.sh_x = (s.layout[0][0] - s.abreast_x * s.icon_size_x) / 2
     s.sh_y = (s.layout[0][1] - s.abreast_layout_y * s.icon_size_y) / 2
     s.total_size = (s.abreast_x * s.icon_size_x,
                     s.icon_size_y * s.abreast_full_y)
     s.img_1 = Image.new(s.total_size)
     s.img_1.clear(s.color_background)
     s.img = Image.new(
         (s.total_size[0], min(s.layout[0][1] - s.sh_y * 2,
                               s.total_size[1])))
     x, y = 0, 0
     for i in s.list_coords:
         s.img_1.blit(s.images,
                      source=i,
                      target=(x * s.icon_size_x, y * s.icon_size_y))
         x += 1
         if x == s.abreast_x:
             x = 0
             y += 1
 def prerender_text(self):
     tr = appuifw.app.body.measure_text(self.victory, font='title')[0]
     self.text_pos = ((self.x - tr[2] + tr[0]) / 2,
                      (self.y - tr[3] + tr[1]) / 2,
                      (self.x + tr[2] - tr[0]) / 2,
                      (self.y + tr[3] - tr[1]) / 2)
     self.text_img = Image.new((tr[2] - tr[0] + 2, tr[3] - tr[1] + 2))
     self.text_img.clear()
     self.text_img.text((-tr[0] + 2, -tr[1] + 2),
                        self.victory,
                        fill=(64, 64, 64),
                        font='title')
     self.text_img.text((-tr[0], -tr[1]),
                        self.victory,
                        fill=(0, 0, 255),
                        font='title')
     self.text_mask = Image.new((tr[2] - tr[0] + 2, tr[3] - tr[1] + 2),
                                mode='L')
     self.text_mask.clear(0)
     self.text_mask.text((-tr[0] + 2, -tr[1] + 2),
                         self.victory,
                         fill=(255, 255, 255),
                         font='title')
     self.text_mask.text((-tr[0], -tr[1]),
                         self.victory,
                         fill=(255, 255, 255),
                         font='title')
예제 #3
0
파일: gpslogimg.py 프로젝트: psla/pygpslog
 def alphaMask(self, a=None, size=ICONSIZE):
   if a == None:               return self.alphas[(DEFALPHA[0],size)]
   if (a,size) in self.alphas: return self.alphas[(a,size)]
   aimg = Image.new(size, 'L')
   aimg.clear(a)
   self.alphas[(a, size)] = Image.new(size, 'L')
   self.alphas[(a, size)].clear(0);
   self.alphas[(a, size)].blit(self.mask.resize(size), mask=aimg)
   return self.alphas[(a, size)]
예제 #4
0
 def start(s,
           resource,
           callback=lambda: None,
           func_delete=lambda: None,
           stop_callback=lambda: None,
           func_vector=lambda: None):
     s.y, s.z = 0, 0
     y = 0
     s.resource = resource
     s.callback = callback
     s.func_delete = func_delete
     s.stop_callback = stop_callback
     s.func_vector = func_vector
     if not s.resource:
         return None
     s.list = akntextutils.wrap_text_to_array(s.resource, 'annotation',
                                              s.size[0] - 25)
     s.lenlist = len(s.list)
     s.max_str_display = s.size[1] / 20
     s.imgsize = (s.size[0] - 10, min(s.max_str_display * 20,
                                      s.lenlist * 20))
     try:
         del s.img
     except AttributeError:
         pass
     s.img = Image.new(s.imgsize)
     s.capture.keys = [
         63495, 63496, 63497, 63498, 63557, 63554, 63555, 35, 42, 63586, 8
     ] + range(48, 58)
     s.capture.forwarding = 0
     aw.app.focus = s.focus
     s.capture.start()
     s.picture()
예제 #5
0
    def __init__(
        self,
        title=None,
        screen_mode=None,
        fps=None,
        color_mode=None,
        bg_color=None,
    ):
        app.screen = screen_mode or "full"
        app.title = title or u"PyS60 Game"

        self._game_obj = None
        self._is_running = 0
        if fps is None:
            self.fps = FPS_DEFAULT
        else:
            assert isinstance(fps, int) or isinstance(fps, float)
            self.fps = fps

        self.color_mode = color_mode or COLOR_MODE
        self.bg_color = bg_color or BG_COLOR

        self.canvas = Canvas(redraw_callback=self.handle_redraw(),
                             event_callback=self.handle_event())
        app.body = self.canvas
        app.exit_key_handler = self.handle_exit()

        self.buffer = Image.new(self.canvas.size, mode=self.color_mode)
        self.buffer.clear(self.bg_color)
        self.handle_redraw()(None)

        self.key_click = None
        self._key_click_release = 1
        self.key_down = None
        self._key_down_release = 1
예제 #6
0
def help():
    global w, img1
    explain = [
        cn("欢迎使用短信签名测试版"), u"================",
        cn("功能说明:"),
        cn("1.可设置自动回复"),
        cn("2.可设置定时回复"),
        cn("3.可发送闪信"),
        cn("4.签名功能可选"),
        cn("5.具有短信转E功能"), u"================",
        cn("@小布开发版权所有@")
    ]
    w = TopWindow.TopWindow()
    img1 = Image.new((176, 208))
    img1.clear(0)
    for i in range(10):
        img1.text((10, 15 + i * 12), explain[i], fill=0x0000ff)
    w.add_image(img1, (0, 0))
    w.size = (160, 135)
    w.position = (5, 45)
    w.shadow = 5
    w.corner_type = "corner5"
    w.show()
    e32.ao_sleep(10)
    w.hide()
예제 #7
0
파일: gpslogimg.py 프로젝트: psla/pygpslog
 def __init__(self, image, idx, miffile=None, mifidx=None, mifmask=None):
   self.img  = Image.new(ICONSIZE)
   self.mask = Image.new(ICONSIZE,"L")
   sx, sy = ICONSIZE[0], ICONSIZE[1]
   x1, y1 = idx*2*sx % (2*ICONS_PER_ROW*sx) + sx, idx / 2 * sy
   x2, y2 = x1+sx, y1+sy
   self.img. blit(image, source=((x1,   y1),(x2,   y2)))
   self.mask.blit(image, source=((x1-64,y1),(x2-64,y2)))
   self.alphas = {}
   self.resized = {}
   # Pre-Cache standard sizes and alpha
   # for a in DEFALPHA:
   #   for sz in [ ICONSIZE, (ICONSIZE[0]/2,ICONSIZE[1]/2), (ICONSIZE[0]/4,ICONSIZE[1]/4) ]:
   #     self.draw(None, (0,0), sz, a)
   self.miffile = miffile
   self.mifidx  = mifidx
   self.mifmask = mifmask
예제 #8
0
 def start(self):
     app.screen = 'full'
     self._oldScreen = app.body
     app.body = self()
     ao_yield()
     self._image = Image.new(self._screen.size)
     self.width = self._screen.size[0]
     self.height = self._screen.size[1]
     self.redraw()
 def picture(self):
     try:
         self.window_main.remove_image(self.img, (0, 0))
         del self.img
     except Exception:
         pass
     size = (self.width, len(self.items) * 20 + 20)
     self.img = Image.new(size)
     self.window_main.size = size
     self.window_main.position = (self.x_pos, self.y_pos)
     self.img.rectangle((0, 0, size[0], size[1]), 0x0,
                        self.color_background)
     self.img.rectangle((1, 1, size[0] - 1, 20),
                        fill=self.color_background_upper)
     self.img.rectangle(
         (2, self.y * 20 + 22, size[0] - 2, self.y * 20 + 38),
         fill=self.color_cursor)
     a = self.img.measure_text(self.title,
                               'annotation',
                               maxwidth=self.width - 15)
     if len(self.title) > a[2]:
         self.img.text(((self.width - a[0][2]) / 2, 14),
                       self.title[:a[2] - 1] + u'...',
                       self.color_text_upper, 'annotation')
     else:
         self.img.text(((self.width - a[0][2]) / 2, 14), self.title,
                       self.color_text_upper, 'annotation')
     d, n = 20, 0
     for t in self.items:
         n += 1
         if n - 1 is not self.y:
             color_text = self.color_text
         else:
             color_text = self.color_text_cursor
         if n < 10:
             i = unicode(n)
         elif n == 10:
             i = u'0'
         else:
             i = u''
         a = self.img.measure_text(i + u' ' + t[0],
                                   'annotation',
                                   maxwidth=self.width - 23)
         if len(i + u' ' + t[0]) > a[2]:
             self.img.text((4, 14 + d), i + u' ' + t[0][:a[2] - 2] + u'...',
                           color_text, 'annotation')
         else:
             self.img.text((4, 14 + d), i + u' ' + t[0], color_text,
                           'annotation')
         if t[1] is '1':
             self.img.polygon((self.width - 9, 16 + d, self.width - 9,
                               4 + d, self.width - 3, 10 + d),
                              fill=color_text)
         d += 20
     self.window_main.add_image(self.img, (0, 0))
     self.window_main.show()
예제 #10
0
def lab3():#画布界面
    from graphics import Image
    appuifw.app.body=canvas=appuifw.Canvas()
    img=Image.new((240,320))
    img.clear(0x0000ff)
    def redraw():
        canvas.blit(img)
    while True:
        redraw()#借循环语句使redraw函数不断执行,比米饭的简单吧
        e32.Ao_yield()#监控退出命令,使程序能退出
예제 #11
0
 def __init__(self):
     self.old_func_focus = appuifw.app.focus
     appuifw.app.focus = self.focus
     self.focusflag = 1
     if e32.s60_version_info >= (2, 8):
         self.scr = appuifw.app.layout(appuifw.EScreen)[0]
     else:
         self.scr = (176, 208)
     img_none = Image.new((1, 1))
     h = img_none.measure_text(u'by', 'annotation')[0]
     self.__h_text = h[3] - h[1]
     self.__dislocation_text = h[3]
     h2 = img_none.measure_text(u'by', 'dense')[0]
     h_text2 = h2[3] - h2[1]
     self.__dislocation_text2 = h2[3]
     self.__sizeW = 6 + h_text2
     self.__sizeY = self.__sizeW + self.__h_text * 2 + 6
     self.img = Image.new((self.scr[0] - 10, self.__sizeY))
     self.top_shadow = TopWindow()
     x = max(self.scr)
     self.top_shadow.position = (-x, -x)
     self.top_shadow.shadow = x / 2
     self.window = TopWindow()
     self.window.size = (self.scr[0] - 10, self.__sizeY)
     self.window.position = (5, self.scr[1] / 2 - self.__sizeY / 2)
     self.color_background = 0x555500
     self.color_text = 0xffffff
     self.color_background2 = 0xffffff
     self.color_text2 = 0x707070
     self.img1 = Image.new((self.scr[0] - 22, self.__sizeW), mode = 'RGB')
     self.img2 = Image.new((self.scr[0] - 22, self.__sizeW - 2), mode = 'RGB')
     self.img_gradient = Image.new((self.scr[0] - 22, self.__sizeW - 2), mode = 'RGB')
     r = 255 / ((self.scr[0] - 22) / 4.0)
     for i in xrange(self.scr[0] - 22):
         if i <= (self.scr[0] - 22) / 4.0:
             self.img_gradient.line((i, 0, i, self.__sizeW - 2), (255, int(i * r), 0))
         elif (self.scr[0] - 22) / 4.0 < i <= (self.scr[0] - 22) / 2.0:
             self.img_gradient.line((i, 0, i, self.__sizeW - 2), (int(255 - (i - (self.scr[0] - 22) / 4.0) * r), 255, 0))
         elif (self.scr[0] - 22) / 2.0 < i <= (self.scr[0] - 22) * 3 / 4.0:
             self.img_gradient.line((i, 0, i, self.__sizeW - 2), (0, 255, int((i - (self.scr[0] - 22) / 2.0) * r)))
         else:
             self.img_gradient.line((i, 0, i, self.__sizeW - 2), (0, int(255 - (i - (self.scr[0] - 22) * 3 /4.0) * r), 255))
     e32.ao_yield()
예제 #12
0
 def __init__(q):
     q.mfo = (mf + 'CosmoTech\\FScreen\\')
     q.st = ini.read((q.mfo + 'position'))
     q.name = u'F-Screen'
     q.w1 = m.image((q.mfo + 'watermark'), 0)
     q.w2 = m.image((q.mfo + 'watermark'), 1)
     q.hc = q.sc = 0
     sz = q.w1.size
     q.im, q.ss = (IG.new(sz), IG.new(dpx()))
     q.cap = KCR(q.key)
     q.lo = (mg + 'fdrive.dat')
     q.cap.keys = (q.load(q.lo)[1], )
     q.cap.start()
     if q.load(q.lo)[0] == u'':
         q.b = 'None'
     else:
         q.b = q.load(q.lo)[0]
     if q.load(q.lo)[2] == u'':
         q.w = 'None'
     else:
         q.w = q.load(q.lo)[2]
     if q.load(q.lo)[1] == 8:
         ke = u'C (Delete)'
     else:
         ke = u'Green Key/Call'
     q.list = [(u'Status', u'Active'), (u'Shot Button', ke),
               (u'Watermark & Background',
                unicode(q.w[:-4] + ' | ' + path.split(q.b)[1])),
               (u'About', q.un('\xc2\xa9 2018, Cosmo TechZone'))]
     q.lb = LB(q.list, q.sel)
     AP.body = q.lb
     AP.title = u'F-Screen'
     AP.exit_key_handler = q.mi
     AP.menu_key_text = u'Options'
     AP.exit_key_text = u'Minimize'
     AP.menu = [(u'Change Watermark', q.cwm), (u'Change Background', q.cbg),
                (u'Clear Background', q.clr), (u'Exit', q.ex)]
     try:
         sw = q.load(q.lo)[0]
         q.bg = IG.open(sw).resize(sz)
     except:
         pass
예제 #13
0
 def start(s, resousce):
     try:
         y = aw.app.body.pos2xy(aw.app.body.get_pos())[1]
     except AttributeError:
         return None
     s.y, s.z = 0, 0
     s.resousce = resousce
     if not s.resousce:
         return None
     elif type(s.resousce) == type([]) or type(s.resousce) == type(()):
         s.mode = 'list'
         s.list = []
         for t in s.resousce:
             a = s.imgnone.measure_text(t[0],
                                        'dense',
                                        maxwidth=s.size[0] - 25)[2]
             if a < len(t[0]):
                 t[0] = '%s%s' % (t[0][:a - 1], u'...')
             s.list.append(t[0])
     elif type(s.resousce) == type(u''):
         s.list = akntextutils.wrap_text_to_array(s.resousce, 'dense',
                                                  s.size[0] - 25)
         s.mode = 'text'
     else:
         return None
     s.lenlist = len(s.list)
     center = s.size[1] / 2
     if aw.app.screen == 'normal':
         y += s.layout[1][1]
     if y > center + 8:
         s.max_str_display = (y - 17) / 16
         s.imgsize = (s.size[0] - 10,
                      min(s.max_str_display * 16, s.lenlist * 16))
         s.window_position = 5, 5
     else:
         s.max_str_display = (s.size[1] - y - 8) / 16
         s.imgsize = (s.size[0] - 10,
                      min(s.max_str_display * 16, s.lenlist * 16))
         s.window_position = 5, max(y + 2, s.size[1] - s.imgsize[1] - 5)
     try:
         del s.img
     except AttributeError:
         pass
     s.img = Image.new(s.imgsize)
     if s.mode == 'list':
         s.capture.keys = [63497, 63498, 63557, 63554, 63555]
     elif s.mode == 'text':
         s.capture.keys = [
             63495, 63496, 63497, 63498, 63557, 63554, 63555, 35, 42, 63586
         ] + range(48, 58)
     s.capture.forwarding = 0
     aw.app.focus = s.focus
     s.capture.start()
     s.picture()
 def __init__(self):
     s = appuifw.app.layout(appuifw.EMainPane)[0]  # drawing area size
     self.x = s[0]
     self.y = s[1]
     self.frame = Image.new((self.x, self.y))  # for double buffering
     #DEBUG self.frames = 0
     self.victory = u'Congratulations!'
     self.entropy_num = 3
     self.entropy_den = 4
     self.SELECTED_TILE_COLOR = (255, 0, 0)
     self.EMPTY_TILE_COLOR = (255, 255, 128)
     self.new_game(16)
예제 #15
0
 def __init__(s):
     s.capture = KeyCapturer(s.keys_answer)
     s.window = FGImage()
     try:
         s.layout = aw.app.layout(aw.EMainPane)
     except AttributeError:
         s.layout = ((176, 144), (0, 44))
     s.size = (s.layout[0][0], s.layout[0][1] + s.layout[1][1])
     s.imgnone = Image.new((1, 1))
     s.focusflag = 0
     s.resousce = None
     s.initialization()
예제 #16
0
 def genImage(self):
     img = Image.new((cardWidth, cardHeight))
     img.rectangle((0, 0, cardWidth, cardHeight), self.borderColour,
                   self.bgColour)
     if self.visible:
         txtimg = Image.new((cardWidth - 2, cardHeight / 2 - 1))
         txtimg.rectangle((0, 0, cardWidth - 2, cardHeight / 2 - 1),
                          self.bgColour, self.bgColour)
         txtimg.text((1, 8), unicode(self.name()), self.colour(),
                     u'fixed6x10')
         img.blit(txtimg, target=(1, 1))
         img.blit(txtimg.transpose(ROTATE_180),
                  target=(1, cardHeight / 2 + 1))
     else:
         repeat = 4
         for top in range(0, repeat):
             img.ellipse([(cardWidth / 3, cardHeight * (top * 2 + 1) /
                           (repeat * 2 + 2)),
                          (cardWidth * 2 / 3, cardHeight * (top * 2 + 3) /
                           (repeat * 2 + 2))], self.patternColour1,
                         self.patternColour2)
     return img
예제 #17
0
 def __init__(s):
     s.capture = KeyCapturer(s.keys_answer)
     s.window = FGImage()
     try:
         s.layout = aw.app.layout(aw.EMainPane)
     except AttributeError:
         s.layout = ((176, 144), (0, 44))
     s.size = s.layout[0]
     s.imgnone = Image.new((1, 1))
     s.focusflag = 0
     s.resource = None
     s.color_window = 0xffffbb
     s.color_outline = 0xaa9050
     s.color_text = 0
     s.color_indicator = 0xff8000
     s.y, s.z = 0, 0
예제 #18
0
 def picture1(self):
     try:
         self.window_add1.remove_image(self.img_add1, (0, 0))
         del self.img_add1
     except Exception:
         pass
     size = (self.width_add1, len(self.items[self.y][2]) * 20)
     self.img_add1 = Image.new(size)
     self.window_add1.size = size
     self.window_add1.position = (self.x_pos_add1, self.y_pos_add1)
     self.img_add1.rectangle((0, 0, size[0], size[1]), 0x0,
                             self.color_background_add1)
     self.img_add1.rectangle(
         (2, self.y1 * 20 + 2, size[0] - 2, self.y1 * 20 + 18),
         fill=self.color_cursor_add1)
     d, n = 0, 0
     for t in self.items[self.y][2]:
         n += 1
         if n - 1 is not self.y1:
             color_text = self.color_text_add1
         else:
             color_text = self.color_text_cursor_add1
         if n < 10:
             i = unicode(n)
         elif n == 10:
             i = u'0'
         else:
             i = u''
         a = self.img_add1.measure_text(i + u' ' + t[0],
                                        'annotation',
                                        maxwidth=self.width_add1 - 23)
         if len(i + u' ' + t[0]) > a[2]:
             self.img_add1.text((4, 14 + d),
                                i + u' ' + t[0][:a[2] - 2] + u'...',
                                color_text, 'annotation')
         else:
             self.img_add1.text((4, 14 + d), i + u' ' + t[0], color_text,
                                'annotation')
         if t[1] is '2':
             self.img_add1.polygon(
                 (self.width_add1 - 9, 16 + d, self.width_add1 - 9, 4 + d,
                  self.width_add1 - 3, 10 + d),
                 fill=color_text)
         d += 20
     self.window_add1.add_image(self.img_add1, (0, 0))
     self.window_add1.show()
예제 #19
0
    def picture2(self):
        try:
            self.window_add2.remove_image(self.img_add2, (0, 0))
            del self.img_add2
        except Exception:
            pass
        size = (self.width_add2, len(self.items[self.y][2][self.y1][2]) * 20)
        self.img_add2 = Image.new(size)
        self.window_add2.size = size
        self.window_add2.position = (self.x_pos_add2, self.y_pos_add2)
        self.img_add2.rectangle((0, 0, size[0], size[1]), 0x0,
                                self.color_background_add2)
        self.img_add2.rectangle(
            (2, self.y2 * 20 + 2, size[0] - 2, self.y2 * 20 + 18),
            fill=self.color_cursor_add2)
        d, n = 0, 0
        for t in self.items[self.y][2][self.y1][2]:
            n += 1
            if n - 1 is not self.y2:
                color_text = self.color_text_add2
            else:
                color_text = self.color_text_cursor_add2
            if n < 10:
                i = unicode(n)
            elif n == 10:
                i = u'0'
            else:
                i = u''
            a = self.img_add2.measure_text(i + u' ' + t[0],
                                           'annotation',
                                           maxwidth=self.width_add2 - 23)
            if len(i + u' ' + t[0]) > a[2]:
                self.img_add2.text((4, 14 + d),
                                   i + u' ' + t[0][:a[2] - 2] + u'...',
                                   color_text, 'annotation')
            else:
                self.img_add2.text((4, 14 + d), i + u' ' + t[0], color_text,
                                   'annotation')
            d += 20
        self.window_add2.add_image(self.img_add2, (0, 0))
        self.window_add2.show()


# the end :)
예제 #20
0
    def __init__(self, tamanho, conexao):

        #importando as bibliotecas
        sys.path.append(PATHLIB)

        #importando a logica do campo minado
        import campoclient

        self.tamanho = tamanho
        self.jogo = campoclient.JogadorRemoto(tamanho, conexao)

        #variaveis
        self.correnteX = 0
        self.correnteY = 0
        self.largura = 0
        self.altura = 0
        self.limiteLargura = 0
        self.limiteAltura = 0

        self.inimigoX = 0
        self.inimigoY = 0

        self.vezDoOutro = True

        self.imagemCasa = self.imagensCasas()

        self.sons = self.som()

        self.outro = 0
        self.jogador = 0
        self.bombas = self.jogo.getBombas()

        self.podeJogar = False

        self.img = Image.new(sysinfo.display_pixels())
        #self.img.blit(Image.open(PATHICON + "t" + str(self.tamanho) +  ".PNG"))

        self.defineCorpoDaAplicacao(
            appuifw.Canvas(redraw_callback=self.handle_redraw))

        self.setkeys()
        self.lista = []
        self.somEnable = True
        self.acabou = False
예제 #21
0
파일: UBBEdit.py 프로젝트: Symbian9/pycoder
def start_page():
    ui.app.title = cn('欢迎使用')
    ui.app.exit_key_handler = exit
    x, y = ui.app.layout(ui.EMainPane)[0]
    from graphics import Image
    im = Image.new((x, y))
    im.clear(0xaaaaaa)
    im.text((25, 63), cn(_name), 0xff0000, ('normal', 30))
    im.text((25, 90), cn('版本:' + _ver), 0xffffff, ('normal', 15))
    im.text((25, 115), cn('作者:' + _author), 0xffffff, ('normal', 15))
    im.text((25, 140), cn('日期:' + _date), 0xffffff, ('normal', 15))
    im.text((100, 200), cn(_remarks), 0xffffff, ('normal', 12))
    im.text((100, 220), cn(_website), 0xffffff, ('normal', 11))
    im.line((20, 65, 220, 65), 0xff0000)
    ui.app.body = c = ui.Canvas()
    ui.app.menu = [(cn('新建'), start_menu_new), (cn('打开'), start_menu_open)]
    while run_start_page:
        c.blit(im)
        e32.ao_yield()
예제 #22
0
def viewit(top, tro):
    img=Image.new((176, 200))
    img.clear((180, 180, 180))
    img.polygon(((50, 15), (80, 15), (85, 8), (95, 8), (100, 15), (130, 15), (130, 40), (105, 35), (110, 70), (70, 70), (75, 35), (50, 40)), outline=0, fill=top)
    def tr():
        while 1:
            can.text((110, 55), u'short or long')
            e32.ao_sleep(0.5)
            hand(1)
            e32.ao_sleep(0.5)
    img.polygon((95, 8, 90, 18, 85, 8), (25, 25, 25))
    img.line((90, 18, 90, 70), (25, 25, 25))
    img.polygon(((105, 70), (120, 140), (95, 140), (90, 90), (85, 140), (60, 140), (75, 70)), outline=0, fill=tro)
    if tro==1:
        img.text((120, 100), u'striped...')
    def hand(rect):
        can.blit(img)
    lock=e32.Ao_lock()
    can=ui.Canvas(redraw_callback=hand)
    ui.app.screen='full'
    ui.app.body=can
    #thread.start_new_thread(tr, ())
    ui.app.exit_key_handler=lock.signal
    lock.wait()
예제 #23
0
                    break
        for i  in range(10,m4,10):
                if  chesstray[(x+i)/10-1][(y-i)/10-1]==flag:
                    jg2+=1
                else:
                    break
        if jg1+jg2==4:
            jg=1
def quit():
    global running
    #graphics.screenshot().save("c:\\pic.png")
    running=0
def handle_redraw(rect):
    canvas.blit(img)
appuifw.app.screen='full'
img=Image.new((176,208))
canvas=appuifw.Canvas(event_callback=None,redraw_callback=handle_redraw)
appuifw.app.body=canvas
appuifw.app.exit_key_handler=quit
start_info=[cn("㊣"),cn("㊣"),cn("进"),cn("入"),cn("在"),cn("游"),cn("正"),cn("戏"),cn("㊣"),cn("㊣")]
for y in range(9):
  img.clear(0)
  img.rectangle((0,y*10,176,10+(y*10)), 0x99ccff, fill=0x99ccff)
  img.rectangle((0,198-10*y,176,208-(y*10)), 0x99ccff, fill=0x99ccff)
  handle_redraw(())
  e32.ao_sleep(0.08)
  if y==8:
      for j in range(10):
          img.rectangle((88-10*j,78,88,88),0,fill=0)
          img.rectangle((88,78,88+10*j,88),0,fill=0)
          img.rectangle((88-10*j,120,88,130),0,fill=0)
예제 #24
0
from appswitch import application_list
import kaapython
import ui
_timer = e32.Ao_timer()
(
    (
        width,
        height,
    ),
    (
        x,
        y,
    ),
) = ui.layout(ui.EControlPane)
gbar = FGImage()
image = Image.new((width, height))
_ = kaapython.get_plugin_translator(__file__)
kaapython.app.settings.plugins.append('gbar',
                                      ui.SettingsGroup(_('Graphical Bar')))
kaapython.app.settings.plugins.gbar.append(
    'time_interval',
    ui.FloatSetting(_('Time interval'), value=0.5, vmin=0.1, vmax=60))


def info(self=None,
         python=kaapython.PythonFileWindow,
         settings=kaapython.app.settings.plugins.gbar):
    _timer.cancel()
    if (application_list(1)[0] != u'Kaapython'):
        gbar.unset()
        return _timer.after(settings.time_interval, info)
예제 #25
0
draw = graphics.Draw(c)
sip = sysinfo.display_pixels()
global set1, set2
set1 = sip[0]
set2 = sip[1]
x, y = 88, 104
vx, vy = 1, 1
fx, fy = 88, 104
huyfdgrf = 1
huyidgrf = 1
huyidgif = 0x0000FF
huyjdgif = 1
hvyjdgif = None
hvyjbgif = 1
global huydgrf
huydgrf = Image.new((set1, set2))


def hvgjbgif():
    c.rectangle([0, 0, 16, 193], 0x000000)
    c.line([0, 64, 16, 64], 0x000000)
    c.line([0, 128, 16, 128], 0x000000)
    c.line([0, 193, 14, 193], 0x000000)
    c.rectangle([4, 3, 9, 6], 0x00FF00, fill=0x00FF00)
    c.rectangle([9, 3, 13, 7], 0xFF0000, fill=0xFF0000)
    c.rectangle([9, 6, 13, 12], 0xFF8000, fill=0xFF8000)
    c.rectangle([4, 6, 10, 12], fill=huyidgif)
    c.line([8, 18, 8, 27], 0xFFFFFF, width=4)
    c.line([8, 18, 8, 27], huyidgif, width=huyjdgif)
    c.rectangle([4, 35, 13, 44], huyidgif, fill=hvyjdgif)
    c.line([4, 35, 13, 44], huyidgif)
예제 #26
0
 def genImage(self):
     img = Image.new((cardWidth, cardHeight))
     img.rectangle((0, 0, cardWidth, cardHeight), 0x000000, tableColour)
     return img
예제 #27
0
    def desenhaUltimaEscolha(self,x, y):
	self.desenhaCasaAtual(x, y)
	mask_name = Image.new(self.imagemCasa["iultima"].size,'1')
	mask_name.blit(self.imagemCasa["iultima"])
	self.canvas.blit(self.imagemCasa["ultima"], target=(self.largura * x, self.altura * y), mask = mask_name)
예제 #28
0
lock=e32.Ao_lock()
b='None'
def rec(arg):
    global b
    red(1)
    a=unicode(arg['scancode'])
    b=unicode(arg['keycode'])
    can.text((10, 50), a, font='legend')
    can.text((35, 50), u'('+hex(int(a))+u')', font='symbol')
    can.text((10, 115), b, font='legend')
    can.text((45, 115), u'('+hex(int(b))+u')', font='symbol')
    if arg['type']==ui.EEventKeyUp:
        red(1)
        
def red(rect):
    global a
    if  b!='0':
        a=b
    can.blit(img)
    can.text((5, 165), u'last keycode is %s' %a, font='title')
    
img=Image.new((176, 144))
img.clear(0xb08080)
img.text((5, 20), u'scancode of pressed keys', font='title')
img.text((5, 67), u'keycode of pressed keys', font='title')
img=img.resize((176, 208))
can=ui.Canvas(redraw_callback=red, event_callback=rec)
ui.app.screen='full'
ui.app.body=can
ui.app.exit_key_handler=lock.signal
lock.wait()
예제 #29
0
파일: 弧形.py 프로젝트: Symbian9/pycoder
#巧⑥ㄨ№【天堂】(16982589)

import appuifw,e32
from graphics import Image
from math import pi
runing=1
def quit():
  global runing
  runing=0
def cn(x):return x.decode('utf-8')
appuifw.app.screen='full'
appuifw.app.body=canvas=appuifw.Canvas()
img=Image.new(canvas.size)
def a():
 img.pieslice((20,40,120,120),3*pi/2,pi,0xee0f0f,width=1,fill=0x925909)#pi==π
 img.arc((110,120,170,190),0,3*pi/2,0x0943861,width=2)
appuifw.app.exit_key_handler=quit
while runing:
  img.clear(0x8cbeff)
  a()
  canvas.blit(img)
  e32.ao_sleep(0.1)
  e32.ao_yield()
예제 #30
0
def tomask(img):
    msk = Image.new(img.size, 'L')
    msk.blit(img)
    return msk
예제 #31
0
    ao_sleep(0)
    ss = screenshot()
    ao_sleep(0)
    del laa


def event(v):
    global sc
    sc, tp = v['scancode'], v['type']


app.exit_key_handler = balik
app.screen = 'full'
app.body = c = Canvas(None, event)
x, y = c.size
im = Image.new((x, y))
axy = 70
w = (x - (2.70 * axy)) / 2
h = (y - (4.6 * axy)) / 3
key, n = {}, 1
for j in range(49, 58):
    key[j] = n
    n += 1
print key
tmp = []

openn = eval(open(pat + 'lock.dat').read().decode('hex'))


def newcode():
    global coba
예제 #32
0
__version__='0.96'
__site__='http://code.google.com/p/still-rainbow'
__author__='Serhiy Zagoriya (int_ua)'
__copyright__ = "Copyright 2009-2010, Serhiy Zagoriya"
__license__ = "GPLv3"
__email__ = "*****@*****.**"
# todo: i18n, scenario linking to other scenario, bookmark color

import appuifw
try:
 import e32,sysinfo,os
 from graphics import Image
except:
 appuifw.note(u'failed to\n import e32,sysinfo,os,graphics','error')

img=Image.new(sysinfo.display_pixels(),'RGB')
appuifw.app.screen='full'
appuifw.app.orientation='portrait'

#home=u'e:\\Python\\sr_files\\'
home=os.path.splitdrive(appuifw.app.full_name())[0]+u'\\private\\e6c858ac\\'
homecsv=home+u'csv\\'

color=[0,255,0]
velocity=10
custom_accuracy=24
showing_info=1
running=0
paused=0
color_channel=0
to_white=0
예제 #33
0
        if flag == 1:
            img.text((70, 180), cn("Blue Win"), 0x00ff00)
        else:
            img.text((70, 180), cn("Red Win"), 0x00ff00)
    if flag == -1:
        alpha_beta(searchDepth, -1000000, 1000000, -1, step_x / 10 - 1,
                   step_y / 10 - 1)
        chesstray[bestMove[0]][bestMove[1]] = -1
        judge(bestMove[0] * 10 + 10, bestMove[1] * 10 + 10)
        if jg == 0:
            flag = 1
    for i in range(15):
        for j in range(15):
            if chesstray[i][j] == -1:
                img.point((i * 10 + 10, j * 10 + 10), clrbr[-1], width=10)
            if chesstray[i][j] == 1:
                img.point((i * 10 + 10, j * 10 + 10), clrbr[1], width=10)
    canvas.blit(img)


img = Image.new((240, 320))
canvas = appuifw.Canvas(redraw_callback=handle_redraw)
canvas.bind(EKeyUpArrow, lambda: move(0, -1))
canvas.bind(EKeyDownArrow, lambda: move(0, 1))
canvas.bind(EKeySelect, lambda: move(0, 0))
canvas.bind(EKeyLeftArrow, lambda: move(-1, 0))
canvas.bind(EKeyRightArrow, lambda: move(1, 0))
appuifw.app.body = canvas
appuifw.app.screen = 'full'
appuifw.app.exit_key_handler = lock.signal
lock.wait()