Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Multiple view generating
-
I am trying to create a table without using tableview because tableview doesn't cant help me, so I created a scrollview with a view inside that view is the row, but I am having trouble with view I can't create more than one row.
import ui d=ui.load_view() def g(text,no): sv=d['scrollview1'] v=sv['view1'] l=v['label1'] b=v['button1'] l.text=l.background_color=b.background_color=text v.add_subview(l) v.add_subview(b) v.frame.y=no*(l.frame.height+5) sv.add_subview(v) for ss,s in enumerate(['red','green'],1): g(s,ss) d.present()
view.pyui
[ { "class" : "View", "attributes" : { "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)", "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)", "enabled" : true, "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)", "flex" : "" }, "frame" : "{{0, 0}, {240, 240}}", "selected" : false, "nodes" : [ { "class" : "ScrollView", "attributes" : { "class" : "ScrollView", "name" : "scrollview1", "frame" : "{{-40, -40}, {320, 320}}", "uuid" : "41AD7B2A-B5ED-4C74-BA2B-24469DA90229", "content_width" : 228, "content_height" : 320 }, "frame" : "{{6, 19}, {228, 182}}", "selected" : true, "nodes" : [ { "class" : "View", "attributes" : { "class" : "View", "name" : "view1", "uuid" : "03D06CC2-E81C-4D70-B02E-6894CE5EB352", "frame" : "{{64, 110}, {100, 100}}", "background_color" : "RGBA(0.800000,1.000000,0.800000,1.000000)" }, "frame" : "{{0, 0}, {228, 74}}", "selected" : true, "nodes" : [ { "class" : "Label", "attributes" : { "font_size" : 18, "text" : "Label", "font_name" : "<System>", "name" : "label1", "class" : "Label", "alignment" : "left", "frame" : "{{39, 21}, {150, 32}}", "uuid" : "6DFB1E3F-0AE3-4AAA-BDE7-1A33E95AE96A" }, "frame" : "{{6, 22}, {150, 32}}", "selected" : true, "nodes" : [ ] }, { "class" : "Button", "attributes" : { "font_size" : 15, "title" : "", "name" : "button1", "corner_radius" : 0, "border_color" : "RGBA(0.700000,1.000000,0.550000,1.000000)", "border_width" : 1, "class" : "Button", "frame" : "{{74, 21}, {80, 32}}", "image_name" : "iob:ios7_play_outline_256", "uuid" : "4D57F024-937D-435D-9099-064D8D644514" }, "frame" : "{{174, 13}, {48, 55}}", "selected" : false, "nodes" : [ ] } ] } ] } ] } ]
-
@yas you seem to be adding v, whch is already a subview of sv, as a subview of sv. you are not creating a copy of v...
what about tableview is not working for you? if you are just doing vertical scrolling, tableview is what you want, just use a custom .content_view in your TableViewCell
-
@JonB Actually I am creating a Downloader like IDM So I am creating this view with a pause and resume button and the label as the progress bar how can I Do this with tableviewcell, An example would be helpful.
Thanks in advance. -
https://github.com/tdamdouni/Pythonista/blob/master/tableview/customtableviewcell.py
Again, the key is content_view -- you can put anything you want in there.
-
On the section header how to change its background color
But this doesn't work for medef tableview_title_for_header(self, tableview, section): # Return a title for the given section. # If this is not implemented, no section headers will be shown. self.background_color='black' return 'Some Section'
-
@yas self is a delegate... It has no bgcolor!
There is not an easy way to change the section header background color. There are some ways using objc_util, but you may want to crawl first before you walk... .
The easiest approach is to keep track of headers on your own, and just create a cell instead of a section header.