#pyqt | Logs for 2018-09-24

Back
[00:09:04] -!- necrose99 has quit [Remote host closed the connection]
[03:06:13] -!- anqxyr has joined #pyqt
[06:20:55] -!- mintograde has joined #pyqt
[06:58:57] -!- mintograde has quit [Ping timeout: 244 seconds]
[07:44:02] -!- nitro25 has joined #pyqt
[09:06:52] -!- BPL has joined #pyqt
[09:18:05] -!- frispete_ has joined #pyqt
[09:21:30] -!- frispete has quit [Ping timeout: 272 seconds]
[09:37:42] -!- agile_prg has joined #pyqt
[10:11:33] -!- frispete_ has quit [Remote host closed the connection]
[10:12:20] -!- frispete_ has joined #pyqt
[10:19:16] -!- frispete_ has quit [Quit: Konversation terminated!]
[10:21:23] -!- frispete has joined #pyqt
[11:39:00] -!- nik90 has joined #pyqt
[11:56:33] -!- nik90 has quit [Ping timeout: 244 seconds]
[12:15:17] -!- Siecje has joined #pyqt
[12:38:31] -!- nik90 has joined #pyqt
[13:23:52] -!- kallesbar has quit [Ping timeout: 244 seconds]
[13:32:18] -!- Siecje has quit [Ping timeout: 272 seconds]
[13:45:52] -!- Siecje has joined #pyqt
[14:10:51] -!- delipickle has joined #pyqt
[14:42:40] -!- maratello has joined #pyqt
[14:49:56] -!- delipickle has quit [Quit: Leaving]
[14:56:55] <maratello> here there!
[14:57:04] <maratello> I mean Hi there
[14:57:30] <altendky> maratello: hyea
[14:57:32] <altendky> heya
[14:59:42] -!- stee has joined #pyqt
[15:02:07] -!- nik90 has quit [Ping timeout: 240 seconds]
[15:04:51] -!- stee has quit [Ping timeout: 260 seconds]
[15:06:54] <altendky> maratello: were you looking for some help?
[15:09:50] <maratello> altendky: stackoverflow, but last time most of the issue are quite specific...
[15:10:42] <altendky> maratello: if you have questions, we can try to help
[15:10:51] <maratello> altendky: how to make scrollarea make last bottom widget be visible after adding few widget into it..
[15:12:15] <maratello> altendky: I tried QScrollArea.makewidgetVisible() method but it makes last widget visible only after I finally complete adding my widgets into qscrollarea
[15:12:33] <altendky> maratello: does it take a long time to add your widgets?
[15:13:48] <maratello> altendky: this is the question which I have asked https://stackoverflow.com it doesn't work as expected if you add widgets dinamically...only when last widget is added it shows last object :(
[15:13:49] <altendky> maratello: it sounds like you may just be blocking the event loop. the gui can't update if you are
[15:15:21] <altendky> maratello: yeah, this sort of gui stuff doesn't do what you think when you do it before starting the event loop (`app.exec()`)
[15:16:03] <altendky> if you do it while the program is running it probably will. often, do less in __init__ (in general in python) and in pyqt specifically trigger that stuff to happen after the loop runs
[15:16:07] <altendky> (singleshot timer etc)
[15:16:19] <maratello> altendky: do you know any workaround? or should I replace QScrollArea?
[15:16:28] <altendky> maratello: you should do what i just said
[15:16:39] <altendky> not do gui positioning dependent stuff when there is no gui yet
[15:16:58] <altendky> i'll code up the example. but i'm basically saying what was already said
[15:18:05] <altendky> maratello: you also want to hold on to references for your gui stuff generally. (using a .ui file and loading it does that for static elements)
[15:18:13] <maratello> I can share the code if you want where it safe to view..
[15:18:30] <altendky> i'm updating your example, just a minute
[15:20:23] <maratello> altendky, frankly speaking it is a little bit different what I wanted to achieve cause option which I posted mostly for static elements, whereas I want to use QScrollArea.widgetvisible() for dinamically adding widgets into QScrollArea.
[15:20:36] <maratello> altendky: but anyway I will wait for your example :)
[15:21:07] <altendky> maratello: it'll work dynamically... as in while the application is actually running rather than before like you have it now
[15:22:34] <maratello> altendky: okay I will wait @_@
[15:28:23] <altendky> maratello: sorry, that took a silly long time. https://gist.github.com
[15:28:43] <altendky> maratello: you can use a .ui and still add the buttons dynamically.
[15:28:51] <maratello> altendky: thx, anyway let me have a look :)
[15:32:55] <maratello> altendky: first time see QTimer.singleShot(0, dialog.show_last) inside ...__main__ construction
[15:33:15] <altendky> maratello: except for the answer you were given a couple days ago?
[15:34:23] <maratello> altendky: no I mean that I never seen using QTimer outside of the "class Widget(QWidget):" :)
[15:41:32] <maratello> altendky: wow, it works...
[15:42:14] <altendky> maratello: what you had showed the widget before it figured out how big the widgets were etc. this lets it figure out the actual gui layout and then makes it visible
[15:42:23] <altendky> *makes sure to scroll to the last widget
[15:43:11] <altendky> maratello: note that if you kept a regular python list of the buttons, you could just `self.buttons[-1]` rather than `self.layout.itemAt(self.layout.count()-1).widget()`
[15:43:38] <altendky> in many cases the qt structures aren't particularly friendly for getting at what you want. sometimes they are, but often not
[15:45:51] -!- swalladge has quit [Ping timeout: 252 seconds]
[15:46:16] <maratello> altendky: yeah, sure my buttons are grouped, at least most of them, right now I am developing GUI program which will dinamically show question with answer and adding new question to next to previous question, and I spend the whole day trying to make autoscroll which you did :)
[15:47:09] <altendky> maratello: so, it would have just worked if you had actually done that. it only didn't work because you were doing it before app.exec()
[15:48:23] <maratello> altendky: well I added button which adds more buttons into layout and qscrollarea scrolled automatically :)
[15:48:42] <altendky> maratello: do you understand the issue? are you familiar with the event loop?
[15:49:34] -!- necrose99 has joined #pyqt
[15:50:04] <maratello> altendky: well, I am not so familiar with event loop
[15:51:08] <altendky> maratello: imagine writing your own program without qt. you already have functions to check if the user clicked on a button or pressed a key or such interaction.
[15:51:49] <altendky> maratello: you might write `while True: if clicked_on_button(): handle_button_click()` and then `if typed_in_textbox(): handle_new_text()`
[15:52:01] <altendky> maratello: and you might do that for each interaction the user can do
[15:52:22] <altendky> maratello: one of those would be resizing the window perhaps, and you'd have to calculate new sizes for the widgets so they fill whatever the new window size is
[15:52:35] <altendky> maratello: that `while True:` is effectively the event loop
[15:53:08] <altendky> maratello: of course, it is written very generically around generic 'events' rather than around specific ones like in the pseudo example above
[15:53:14] <altendky> so...
[15:53:46] <altendky> maratello: the widget sizes aren't calculated until they are actually visible and they are triggered by events.
[15:54:18] <altendky> maratello: so, qt doesn't actually figure out how far down it would need to scroll until that event loop is running. that's what `app.exec()` does, it starts the loop.
[15:56:47] -!- swalladge has joined #pyqt
[16:00:20] <maratello> altendky: so, next objects will be fitted into current app_window sizes but not adding normally into the app_window, cause app.exec() event does not calculate app_window size with newly added widgets, right?
[16:01:18] <altendky> maratello: of sorts
[16:01:30] <altendky> probably various more layers of stuff that hasn't been calculated
[16:03:17] -!- necrose99_ has joined #pyqt
[16:06:33] -!- necrose99 has quit [Ping timeout: 252 seconds]
[16:08:05] <maratello> altendky: do you need it will be more appropriate to replace qscrollarea with something else? here is the picture of the program
[16:08:11] <maratello> altendky: https://ibb.co
[16:09:09] <altendky> maratello: the radio buttons and next question button are in the scroll area? and the question may get long enough to need to scroll?
[16:10:04] <altendky> maratello: in general though, this isn't a scroll area issue. i wouldn't even call it an 'issue' at all. it's just something that needs to be done properly.
[16:10:17] <maratello> altendky: questions with answers (Qradiobuttons) an user adding dinamically depending on the survey..
[16:10:49] <altendky> maratello: sure. as i said before, you wouldn't have even noticed this if you implemented your real code instead of an example :]
[16:11:00] <altendky> maratello: scroll area seems sensible
[16:11:31] <maratello> altendky: user click next and new portions of widgets are added :)
[16:11:52] <altendky> maratello: yes, the event loop would be running at that point, otherwise you wouldn't be getting user input anyways
[16:12:13] <altendky> hmm...
[16:12:33] <altendky> so i'll retract those claims actually
[16:12:42] <altendky> maybe, you'd have to test
[16:14:21] <maratello> altendky: interesting thing as I said earlier scroll.ensureWidgetVisible work only as expected in the end of the survey when program finishes with adding widgest
[16:14:41] <maratello> altendky: okay, sorry for bothering you ;]
[16:14:47] <altendky> maratello: i don't quite follow that
[16:15:12] <altendky> maratello: how would you make the last widget visible prior to having added it?
[16:15:21] <maratello> altendky: let me show...
[16:17:54] <altendky> maratello: you also want the `setWidgetResizable()` to be set to True
[16:18:09] <altendky> maratello: then the widget will fill the body of the scroll area
[16:19:52] <maratello> altendky: okay, set it to resizable, psb, link of the image
[16:19:57] <maratello> altendky: https://ibb.co
[16:20:46] <altendky> maratello: is that showing an issue?
[16:23:01] <altendky> maratello: are you really wanting to show a widget? or scroll to the end?
[16:23:16] <maratello> altendky: just scroll until down
[16:23:43] <maratello> altendky: let me try to edit the code as you showed in the example..
[16:24:42] -!- nitro25 has quit [Remote host closed the connection]
[16:30:04] -!- mintograde has joined #pyqt
[16:35:31] <maratello> altendky: no luck :(
[16:35:38] <maratello> altendky: https://gist.github.com
[16:36:36] <altendky> maratello: it seems like there are two rounds of events that need to get processed for show last or scrolling to the end to work
[16:36:48] <altendky> maratello: it might be better if we can find a signal or event to respond to
[16:38:58] <maratello> altendky: well one of them will be enough, I was trying to complete my task by using setVerticalscrollbar but it didn't work either...so I chose using ensurewidgetisVisible cause it was recommend in stackoverflow site
[16:39:47] <maratello> altendky: maybe when new widgets added this could be a trigger to run show_last..
[16:40:01] <altendky> it has to be after the sizing etc
[16:40:39] <altendky> i'd suggest seeing if you can get a suggestion in #qt (if you do, mention me and i'll listen in)
[16:42:01] <maratello> okay, I will raise the question there
[16:44:23] -!- anqxyr has quit [Read error: Connection reset by peer]
[16:58:48] <maratello> altendky: I modified a little bit code according to your suggestion https://gist.github.com and it works fine thank you very much! :)
[16:59:56] <altendky> maratello: let me know if you find a better option than arbitrarily picking a 10ms delay :|
[17:00:07] <altendky> i think i've got something like that in my code somwhere
[17:02:50] <maratello> altdenky: sure! Can you recommend book which can help with excelling skills in using PyQt? ZetCode http://zetcode.com
[17:03:11] -!- Siecje has parted #pyqt
[17:03:12] <altendky> maratello: i can't, sorry... it's probably to my own detriment but i'm not much of a book person
[17:03:29] <altendky> maratello: the consensus seems to be that there isn't any good up to date book
[17:05:48] <maratello> altendky: yeah, for that reason I though this variant could be optimal variant, I already got book with neat examples but as usually when you go deeper as hard to find good instruction/guidance :]
[17:14:10] -!- maratello has quit [Quit: Leaving]
[17:21:45] -!- maratello has joined #pyqt
[17:29:00] -!- maratello has quit [Quit: Leaving]
[19:00:51] -!- The-Compiler has quit [*.net *.split]
[19:08:46] -!- The-Compiler has joined #pyqt
[19:58:34] -!- BPL has quit [Ping timeout: 240 seconds]
[19:58:45] -!- BPL has joined #pyqt
[22:05:41] -!- mintograde has quit [Ping timeout: 252 seconds]
[23:03:25] -!- nik90 has joined #pyqt
[23:34:45] -!- BPL has quit [Read error: Connection reset by peer]