小编sil*_*ash的帖子

Kivy Multiple Column RecyclerView

我只是在玩Pythonkivy,我已经RecyclerView按照 kivy 官方文档将我的字符串数据加载到 a中。但是我在将对象加载到列表中的多列(如表单数据)时遇到了麻烦。例如,我想将姓名、姓氏和年龄设置为三列,标题标题逐行,我也尝试RecyclerGridLayout使用 3 列,但无论逐行要求如何,它都可以只将名称加载到网格中

<RV>:
    viewclass: 'Label'
    RecycleBoxLayout:
        default_size: None, dp(56)
        default_size_hint: 1, None
        size_hint_y: None
        height: self.minimum_height
        orientation: 'vertical'
Run Code Online (Sandbox Code Playgroud)

将欣赏任何提示或示例代码以了解 RecyclerView 如何工作 kivy

python python-3.x kivy kivy-language

5
推荐指数
1
解决办法
4236
查看次数

如何从Gtk 3窗口动态添加/删除小部件

我在Gtk3中使用python3,我基本上需要remove从我的一些小部件中删除并Gtk.Window在a Gtk.Button是时将其替换为其他小部件clicked。我已经尝试将Gtk.ListBoxes与Gtk.ListBoxRows 一起使用,到目前为止我可以从中删除所有Rows,ListBox但是当我尝试添加它们时返回,基本上什么也没发生。这是我的代码的一部分:

def left_view(self, box):
    listbox = box

    row0 = Gtk.ListBoxRow()
    row0.set_halign(Gtk.Align.START)
    listbox.add(row0)
    #Adding HorizontalBox to place widgets
    hbox = Gtk.Box(spacing=10,orientation=Gtk.Orientation.HORIZONTAL)
    row0.add(hbox)
    prod_name = Gtk.Label()
    stock_count = Gtk.Label()
    prod_name.set_text('Product Name')
    stock_count.set_text('Stock   ')
    self.prod_name_input = Gtk.Entry()
    self.stock_count_input = Gtk.Entry()

    #Packaging 101
    hbox.pack_start(prod_name, True, True, 0)
    hbox.pack_start(self.prod_name_input, True, True, 0)
    hbox.pack_start(stock_count, True, True, 0)
    hbox.pack_start(self.stock_count_input, True, True, 0)
Run Code Online (Sandbox Code Playgroud)

该功能将得到一个Gtk.ListBox尝试,当作为argument.And什么我到目前为止remove()add() …

pygobject python-3.x gtk3

4
推荐指数
1
解决办法
1071
查看次数

标签 统计

python-3.x ×2

gtk3 ×1

kivy ×1

kivy-language ×1

pygobject ×1

python ×1