我只是在玩Python和kivy,我已经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
我在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() …