コード例 #1
0
def setup_board():

    pictures = []
    buttons = []

    for x in range(0, 3):
        for y in range(0, 3):

            picture = Picture(picture_grid,
                              image=get_random_sprite(),
                              grid=[x, y])
            picture.bg = "royal blue"
            picture.tk.config(height=100)
            picture.tk.config(width=100)
            pictures.append(picture)

    button_number = 0
    for x in range(0, 3):
        for y in range(0, 3):
            button = PushButton(button_grid,
                                command=match,
                                args=[False],
                                grid=[x, y])
            button.width = 100
            button.height = 100
            button.icon(get_random_sprite())
            button.bg = "dodger blue"
            button_number += 1
            buttons.append(button)

    chosen_one = get_random_sprite()

    winning_button = randint(0, 8)
    buttons[winning_button].icon(chosen_one)
    buttons[winning_button].update_command(match, args=[True])
    pictures[randint(0, 8)].value = chosen_one

    app.display()
コード例 #2
0
    message.value = newInsult


adjectiveOne = []
adjectiveTwo = []
noun = []
#open insults.csv in read mode
with open("insults.csv", "r") as file:
    for singleLine in file:
        word = singleLine.split(",")
        adjectiveOne.append(word[0])
        adjectiveTwo.append(word[1])
        noun.append(word[2].strip())

#create gui
app = App(bg="#C0C5FF")
app.title = "Insult with Shakespear"
picture = Picture(app, image="theman.png")
picture.height = 400
picture.weidth = 350
picture.bg = "#C0C5FF"
message = Text(
    app, insultMe()
)  # creates a Text object, adds it to the app and then calls the function to get an insult
message.font = "arial bold"
message.bg = "#C0C5FF"
#create PushButton object
#calls new Insult function
button = PushButton(app, newInsult, text="Insult me again!")
app.display()
コード例 #3
0
text4 = Text(left_box, size=10, text="Neural Compute Stick : ", grid=[0, 3])
checkbox2 = CheckBox(left_box, command=nbox, grid=[1, 3])

text1 = Text(left_box, size=10, text="Device : ", grid=[0, 0])
combo1 = Combo(left_box,
               options=["Picamera", "USB Camera", "File"],
               width=10,
               command=input_choice,
               grid=[1, 0])
text2 = Text(left_box, size=10, text="Style : ", grid=[0, 1])
combo2 = Combo(left_box,
               command=show_img,
               options=["Mosaic", "Candy", "Princess", "Udnie", "NCS 13"],
               width=10,
               grid=[1, 1])

text = Text(left_box, size=10, text="Downscale : ", grid=[0, 4])
slider = Slider(left_box, start=1, end=10, grid=[1, 4])
#slider.bg='gray10'

picture_box = Box(center_box, align="right")
picture = Picture(picture_box,
                  align="top",
                  width=200,
                  height=200,
                  image="../images/output-images/amber-mosaic.jpg")
picture_box.bg = "white"
picture.bg = "white"

app.display()