コード例 #1
0
 def setImage(self, imagePath):
     if imagePath:
         path = os.path.join("Data", "Pics", "Abilities",
                             imagePath + ".png")
         self.image = Image(file=path)
     else:
         self.image = None
コード例 #2
0
def update_pic():
    here = sys.path[0]
    image_path = os.path.join(here, "test.png")
    image = Image(file=image_path)
    view = ImageTestView(size=win.size)
    view.add(btn1)
    view.add(btn5)
    win.add(image)
    view.become_target()
    win.show()
コード例 #3
0
 def draw(self, c, r):
     here = sys.path[0]
     image_path = os.path.join(here, "test.png")
     image = Image(file=image_path)
     c.backcolor = yellow
     c.erase_rect(r)
     main_image_pos = (30, btn1.bottom + 30)
     src_rect = (0, 0, 571, 416)
     #say("Image bounds =", src_rect)
     dst_rect = offset_rect(src_rect, main_image_pos)
     #say("Drawing", src_rect, "in", dst_rect)
     image.draw(c, src_rect, dst_rect)
コード例 #4
0
def test():
	file = "grail_masked.tiff"
	#file = "spam_masked.tiff"
	image = Image(os.path.join(sys.path[0], file))
	cursor = Cursor(image)
	win = Window(title = "Image Cursor", width = 500, height = 400)
	view1 = TestDrawing(position = (20, 20), size = (100, 70), cursor = cursor)
	view2 = TestScrollableView(position = (140, 20), size = (200, 200),
		scrolling = 'hv')
	view2.cursor = cursor
	win.add(view1)
	win.place(view2, sticky = 'nsew')
	win.shrink_wrap((20, 20))
	win.show()
コード例 #5
0
ファイル: SkinSelector.py プロジェクト: TheOneTrueGod/DunGen
    def initializeImages(self, parent):
        self.images = []
        self.imageNames = []
        skins = [
            file for file in os.listdir(os.path.join("Data", "Pics", "Actors"))
            if file[len(file) - 4:].upper() == ".PNG"
        ]
        for skin in skins:
            self.images += [
                Image(file=os.path.join("Data", "Pics", "Actors", skin))
            ]
            self.imageNames += [skin]

        btn = Button(title="Back", action=self.backClicked, style='default')
        btn.position = ((self.width - btn.width) / 2,
                        self.height - btn.height - 10)
        self.add(btn)
コード例 #6
0
	def _init_from_resource(self, resource_name, hotspot):
		image = Image(file = find_resource(resource_name))
		if not hotspot:
			hotspot = _hotspot_for_resource(resource_name)
		self._init_from_image(image, hotspot)
コード例 #7
0
ファイル: Components.py プロジェクト: TheOneTrueGod/DunGen
from GUI import View, Button, Image
コード例 #8
0
ファイル: Church.py プロジェクト: TheOneTrueGod/DunGen
 def setImage(self, imagePath):
     path = os.path.join("Data", "Pics", "Actors", imagePath + ".png")
     self.image = Image(file=path)
コード例 #9
0
ファイル: 21-image.py プロジェクト: mnabeelp/PyGUI
        dst_rect = rect_sized((10, 340), (150, 150))
        #say("Drawing", src_rect, "in", dst_rect)
        image.draw(c, src_rect, dst_rect)
        dst_rect = rect_sized((200, 340), (100, 100))
        #say("Drawing", src_rect, "in", dst_rect)
        image.draw(c, src_rect, dst_rect)
        dst_rect = rect_sized((340, 340), (50, 50))
        #say("Drawing", src_rect, "in", dst_rect)
        image.draw(c, src_rect, dst_rect)


import os, sys

here = sys.path[0]
image_path = os.path.join(here, "imac.jpg")
image = Image(file=image_path)

win = Window(size=(500, 500))
view = ImageTestView(size=win.size)
win.add(view)
view.become_target()
win.show()

instructions = """
There should be a 360x264 image of an iMac with a rectangle drawn
around part of the image. This part should appear at three different
sizes (150x150, 100x100, 50x50) below the main image.
"""

say(instructions)
application().run()
コード例 #10
0
 def setupComponents(self):
     path = os.path.join("Data", "Pics", "Abilities", "Frame.png")
     self.border = Image(file=path)
     self.image = None
コード例 #11
0
 def setupComponents(self):
     path = os.path.join("Data", "Pics", "Equipment", "EmptySlot.png")
     self.border = Image(file=path)
     self.image = None
コード例 #12
0
from GUI import Window, View, Image, application, Dialog, Label
from GUI.Geometry import offset_rect, rect_sized
from GUI.StdColors import white

import os, sys, serial, time, pyglet, wave
pyglet.options['audio'] = ('openal', 'silent')
f = serial.Serial('/dev/cu.usbmodemFD121', 9600, timeout=.3)

#open images
here = sys.path[0]
image_path = os.path.join(here, "room.jpg")
room = Image(file=image_path)
image_path = os.path.join(here, "m_off.png")
m_off = Image(file=image_path)
image_path = os.path.join(here, "m_on.png")
m_on = Image(file=image_path)
image_path = os.path.join(here, "n_off.png")
n_off = Image(file=image_path)
image_path = os.path.join(here, "n_on.png")
n_on = Image(file=image_path)
image_path = os.path.join(here, "p_off.png")
p_off = Image(file=image_path)
image_path = os.path.join(here, "p_on.png")
p_on = Image(file=image_path)


class dashboard(View):

    tags = 0
    present = False
    alarm = False