- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我试图使用键盘输入 1 和 2 来选择图库 1 或 2,这是要在屏幕上加载的图像列表使用此代码在一个画廊中运行良好
import pygame
WIDTH = 1366
HEIGHT = 768
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.NOFRAME)
clock = pygame.time.Clock() # Needed to limit the frame rate.
pygame.display.set_caption('Katso')
# Put the images into a list.
images = [
pygame.image.load('assets/download.png').convert(),
pygame.image.load('assets/mickey.jpg').convert(),
pygame.image.load('assets/cat.jpg').convert(),
pygame.image.load('assets/flavours.jpg').convert(),
pygame.image.load('assets/hallway.jpg').convert(),
]
image_index = 0
image = images[image_index] # The current image.
x = 0 # x coordnate of image
y = 0 # y coordinate of image
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
image_index -= 1 # Decrement the index.
elif event.key == pygame.K_RIGHT:
image_index += 1 # Increment the index.
# Keep the index in the valid range.
image_index %= len(images)
# Switch the image.
image = images[image_index]
screen.fill((30, 30, 30))
# Blit the current image.
screen.blit(image, (x, y))
pygame.display.update()
clock.tick(30) # Limit the frame rate to 30 fps.
pygame.quit()
但是尝试添加更多列表并被选择是行不通的。我尝试在不同的循环和同一循环下选择图库,但没有任何效果。
import pygame
WIDTH = 1366
HEIGHT = 768
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.NOFRAME)
clock = pygame.time.Clock() # Needed to limit the frame rate.
pygame.display.set_caption('Katso')
# Put the images into a list.
gallery1 = [
pygame.image.load('assets/download.png').convert(),
pygame.image.load('assets/mickey.jpg').convert(),
pygame.image.load('assets/cat.jpg').convert(),
pygame.image.load('assets/flavours.jpg').convert(),
pygame.image.load('assets/hallway.jpg').convert(),
]
gallery2 = [
pygame.image.load('assets/adv.jpg').convert(),
pygame.image.load('assets/star.jpg').convert(),
pygame.image.load('assets/images.jpeg').convert(),
pygame.image.load('assets/tile.png').convert(),
]
x = 0 # x coordnate of image
y = 0 # y coordinate of image
running = True
gallery = gallery1 #set the default gallery
image_index = 0
image = gallery[image_index] # The current image.
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_1:
gallery = gallery1
elif event.key == pygame.K_2:
gallery = gallery2
elif event.key == pygame.K_LEFT:
image_index -= 1 # Decrement the index.
elif event.key == pygame.K_RIGHT:
image_index += 1 # Increment the index.
# Keep the index in the valid range.
image_index %= len(gallery)
# Switch the image.
image = gallery[image_index]
screen.fill((30, 30, 30))
# Blit the current image.
screen.blit(image, (x, y))
pygame.display.update()
clock.tick(30) # Limit the frame rate to 30 fps.
pygame.quit()
最佳答案
在我发布问题后,我终于让它工作了我很高兴看到任何改进该程序工作方式的提示或想法。
import pygame
WIDTH = 1366
HEIGHT = 768
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT), pygame.NOFRAME)
clock = pygame.time.Clock() # Needed to limit the frame rate.
pygame.display.set_caption('Katso')
# Put the images into a list.
gallery1 = [
pygame.image.load('assets/download.png').convert(),
pygame.image.load('assets/mickey.jpg').convert(),
pygame.image.load('assets/cat.jpg').convert(),
pygame.image.load('assets/flavours.jpg').convert(),
pygame.image.load('assets/hallway.jpg').convert(),
]
gallery2 = [
pygame.image.load('assets/adv.jpg').convert(),
pygame.image.load('assets/star.jpg').convert(),
pygame.image.load('assets/images.jpeg').convert(),
pygame.image.load('assets/tile.png').convert(),
]
x = 0 # x coordnate of image
y = 0 # y coordinate of image
running = True
gallery = gallery1 #set the default gallery
image_index = 0
image = gallery[image_index] # The current image.
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_1:
gallery = gallery1
elif event.key == pygame.K_2:
gallery = gallery2
elif event.key == pygame.K_LEFT:
image_index -= 1 # Decrement the index.
elif event.key == pygame.K_RIGHT:
image_index += 1 # Increment the index.
# Keep the index in the valid range.
image_index %= len(gallery)
# Switch the image.
image = gallery[image_index]
screen.fill((30, 30, 30))
# Blit the current image.
screen.blit(image, (x, y))
pygame.display.update()
clock.tick(30) # Limit the frame rate to 30 fps.
pygame.quit()
关于python - 设置并选择要浏览其图像的画廊,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49590866/
我正在为我的网站编辑/创建以下脚本。正如你在下面看到的,我希望他添加一个 在每一行的开头。 (很难解释)。然后使用 var“getal”,我希望他在 4 个项目之后结束这个 DIV 标签(4x for
您好,我想使用 android 画廊和 gridview 教程开发相册,当我在 gridview 中单击图像时,单击图像位置的画廊 Activity 。 最佳答案 如果我是对的,您需要使用其位置转到图
我正在计划一个动态的 PHP 照片库,但在确定通过 MySQL 检索缩略图后显示缩略图的最佳方式时遇到了困难。我考虑过使用内联无序列表,但这导致拇指一个叠一个(触摸)。还尝试了一个表格,但不确定如何在
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
您好,我在使用 JS 创建动态图库时遇到了问题: 我不知道如何使用 JS - “gallery-pk-1-1”获取我的画廊 我不会用JS在相册中添加图片 点击打开漂亮的画廊(如果我只是使用上
有人会告诉我为什么:悬停不检测正确的 child 只将整体视为一个元素,即使我区分了更多的 child 并且一直在同一屏幕上更改我,如何解决?当我尝试将鼠标悬停在元素“.image”上时,我需要这样做
我正在尝试制作一个响应式 9×9 画廊,在悬停时带有叠加层(尝试使用带有颜色和文本的 div)。像这样:Slide in Overlay from the Bottom . 但是,我不能完全覆盖图像。
我想实现一个允许用户将项目拖出的画廊。这不应该妨碍滚动/滑动。 鉴于界面布局,用户只能沿垂直路径将项目拖出图库,并水平滚动图库。 这可行吗?有没有一种简单的方法来检测水平运动,将它们推迟到画廊的事件处
我正在尝试使用 Gallery 小部件构建一组水平滚动的 Web View 。问题是我无法滑动 View ,这当然适用于图像库。按照食谱代码,在 Activity 的 onCreate() I 中:
我正在尝试获取一个 slider 来展示我在帖子中的图片。我目前已设置好所有内容,但我只有一个 li 元素显示所有三张图片。我很想拥有三个 li 元素,每个元素显示一张图片,但我不知道如何自动隔离每张
我们使用的是 jQuery 1.7.1 和 Fancybox 1.3.4。我是 Fancybox 的新手。昨天之前我从未使用过它,但它在我正在工作的网站上广泛使用。设立 Fancybox 的人被解雇了
我想在我的 Activity 中查看画廊,但我不知道它发生了什么,它没有显示任何内容并崩溃。 在创建 Activity 方法时,我有: // initializing gallery view wit
我想根据数组中设置的图像数量创建一个图像 block 。喜欢这个画廊 block : [![在此处输入图像描述][1]][1] 我尝试的是这样的:
我有几个Venobox同一页面上的画廊。有些画廊有数百张照片,这就是为什么我只显示每个画廊的前 3 张缩略图。 当用户开始查看某个图库(单击任何缩略图)时,必须出现单击的图像,并且后台
我正在将 GLightbox JS 库用于作品集图库,并希望在单击内部元素外部时能够关闭图库。 我发现了类似性质的其他问题,但我避免使用 jQuery,并且无法找到适合此特定用例的解决方案。另外,看起
所以我试图循环遍历这个数组并每隔几秒更改一个图像源。现在我有一个 onload 事件调用 setTimeOut 方法,我认为该方法应该在页面加载后 5 秒更改图像,但它是立即执行的。问题是什么?这是我
我对 javascript 相当陌生,但我基本上试图通过图库进行下一次/上一次点击。我设法找到了教程和位来获取图像以供点击。但是我似乎无法弄清楚如何在第四张(最后一张)图像之后返回到该系列的开头。 这
我有一页 6 张图片,每张图片都不同的房子。单击时,我希望每张图像都能打开一个 fancybox 画廊,其中包含同一所房子的 4 张新的更详细的图像。最后,我希望 fancybox 中的 4 张详细照
我正在开发一个带有缩略图的简单 jQuery 图片库。 我想要的部分功能是,如果您单击当前显示的主画廊幻灯片 .show,它会删除 show 类,并淡出然后淡入下一张幻灯片并向其添加一个 show 类
我正在创建一个模板。除了 jquery 图像库之外,所有 xhtml/css 工作都已完成。周围有太多jquery库,我不知道如何根据情况定制它们 这是一个三列模板。第一列有导航。第二列将从第三列的缩
我是一名优秀的程序员,十分优秀!