include example of how to get the required TargetEntry for drag and drop
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 42/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
调研方向
从当前的拖放教程开始,将其对放置操作的处理方式与提供的 pygtk 教程示例进行比较。检查教程如何说明接受来自其他应用程序的拖动以及创建 TargetEntries;完成标准是其中包含一个可正常工作的 PyGObject 示例,或涵盖这两点的等效指导。
由索引模型根据 Issue 内容生成。
描述
I wanted to build an app which accepts drags. I looked up the drag and drop tutorial but it wasn't clear to me how I would make my app accept drags from other applications. Also, I needed to produce the necessary TargetEntries which I didn't know how to do.
The following example is ported from the pygtk tutorial but uses pygi. Maybe it's possible to include that somehow in the current tutorial.
#!/usr/bin/env python
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gdk
def motion_cb(wid, context, x, y, time):
Gdk.drag_status(context, Gdk.DragAction.COPY, time)
return True
def drop_cb(wid, context, x, y, time):
l.set_text('\n'.join([str(t) for t in context.list_targets()]))
context.finish(True, False, time)
return True
w = Gtk.Window()
w.set_size_request(200, 150)
w.drag_dest_set(0, [], 0)
w.connect('drag-motion', motion_cb)
w.connect('drag-drop', drop_cb)
w.connect('destroy', lambda w: Gtk.main_quit())
l = Gtk.Label()
w.add(l)
w.show_all()
Gtk.main()
- 主要语言
- Python
- 星标
- 392
- 派生
- 157
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sebp/PyGObject-Tutorial 的其他 Issue
-
难度 5/5 一周以上 新手友好度 20/100
sebp/PyGObject-Tutorial#229 ·
-
难度 3/5 1-2 天 新手友好度 35/100
sebp/PyGObject-Tutorial#219 ·
-
难度 2/5 1-3 小时 新手友好度 45/100
sebp/PyGObject-Tutorial#218 ·
-
难度 4/5 3-5 天 新手友好度 35/100
sebp/PyGObject-Tutorial#214 ·
-
难度 2/5 1-3 小时 新手友好度 52/100
sebp/PyGObject-Tutorial#210 ·
查看 sebp/PyGObject-Tutorial 的全部 Issue
相似的 Issue
-
good first issue hacktoberfest
难度 1/5 1 小时以内 新手友好度 92/100
维护者通常 1 天内回复
-
tool-calling
难度 2/5 1-3 小时 新手友好度 88/100
vllm-project/vllm#59838 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 92/100
raullenchai/Rapid-MLX#4042 ·
维护者通常 1 天内回复
-
documentation
难度 1/5 1 小时以内 新手友好度 92/100
transitmatters/mbta-slow-zone-bot#70 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
open-webui/open-webui#31871 · 1 条评论 ·
维护者通常 1 天内回复