#pyqt | Logs for 2018-10-10

Back
[01:04:27] -!- altendky has quit [Quit: Connection closed for inactivity]
[02:53:02] <Mrokii> Another question about Qt Designer. Is it possible to set a frames' size policy so that it never gets smaller than the widgets within said frame?
[03:08:20] -!- beeman has quit [Write error: Connection reset by peer]
[03:08:52] -!- beeman has joined #pyqt
[03:12:19] <Mrokii> Seems I've solved the problem.
[03:12:25] <Mrokii> Kind of at least
[03:28:56] -!- joakimd has joined #pyqt
[03:41:03] <joakimd> Hey gang. Im writing a program using PyQt5 and python 3.5, and have encountered a problem where im unable to click items in the list of QComboBox. I can open the list and select using arrowkeys, or just mouse-scroll on the widget without opening the list. I have made a small example, and would appreciate if anyone could have a look and tell me if im doing something wrong. https://pastebin.com
[03:41:21] -!- Mrokii has quit [Ping timeout: 252 seconds]
[03:42:06] -!- Mrokii has joined #pyqt
[04:45:38] -!- anqxyr has joined #pyqt
[06:39:28] -!- mintograde has joined #pyqt
[07:01:53] -!- altendky has joined #pyqt
[07:14:42] -!- joakimd has quit [Quit: Leaving]
[07:18:48] -!- mintograde has quit [Ping timeout: 252 seconds]
[07:41:42] -!- kallesbar has joined #pyqt
[08:07:19] <Mrokii> For some reason my widgets within a QDialog stopped resizing dynamically. Would anybody have a suggestion about what could have gone wrong? Setting a Layout to the dialog itself didn't help, as it seems, unless I did something wrong. :-(
[08:51:04] -!- Siecje has joined #pyqt
[09:51:18] -!- swalladge_ has quit [Ping timeout: 245 seconds]
[09:53:54] <Mrokii> The problem is solved (for now).
[10:54:22] -!- mandeep has joined #pyqt
[10:55:56] <_val_> altendky: how easy is to get the output of this into a dropdown list? http://sprunge.us
[10:56:47] <altendky> _val_: you just want strings?
[10:57:09] <altendky> as opposed to showing strings but getting an object when you 'check' what is selected
[10:57:10] <_val_> altendky: yes
[10:57:23] <altendky> _val_: http://doc.qt.io
[10:58:29] <_val_> altendky: https://www.tutorialspoint.com as this example..
[11:02:58] <altendky> _val_: it looks like one line in their is what i suggested :]
[11:03:55] <_val_> altendky: well I know how to create a combobox but how would I make the code (in a separate file) be included in the pyqt app?
[11:04:09] <_val_> e.g listhosts.py and I have guiapp.py
[11:04:47] <_val_> listhosts.py is as you saw.... now the print("%s\n" % (host.name)) shows a list of hosts available one by one
[11:04:58] <_val_> Now the idea is to get this on a addItem+=(...)
[11:04:59] <altendky> _val_: 'included'? do you have a project with a setup.py and a package? mostly `import mypackage.listhosts; the_combobox.addItems(mypackage.listhosts.get_host_names())` or such
[11:05:19] <altendky> _val_: stop printing, start returning :]
[11:05:29] <_val_> lol
[11:05:35] <altendky> _val_: and put things in functions
[11:05:41] <_val_> altendky: no I want to keep it as sime as possible.
[11:05:54] <altendky> _val_: so you want to have to subprocess that?
[11:05:54] <_val_> s/sime/simple*
[11:05:56] <altendky> _val_: whi?
[11:06:08] <altendky> _val_: ok. simple is writing proper functions and returning what you want
[11:06:12] <_val_> altendky: well it can be in the same file as well
[11:06:15] <altendky> not printing and trying to capture
[11:06:27] <altendky> _val_: doesn't matter where you put it, you should have this in a function
[11:06:41] <altendky> _val_: basically don't do anything in global scope
[11:08:14] <_val_> ok hold a sec
[11:31:36] -!- mandeep has quit [Ping timeout: 252 seconds]
[11:34:33] <_val_> hart to implement this altendky
[11:34:40] <_val_> meh my python level is too low yet
[11:35:26] <_val_> altendky: http://sprunge.us
[11:36:54] <altendky> _val_: https://gist.github.com
[11:40:35] <_val_> Oh cool.. but isn't returning anything
[11:40:56] <altendky> _val_: every function returns something, unless it raises an exception.
[11:41:05] <altendky> _val_: share code and output
[11:41:22] <_val_> altendky: empty
[11:41:27] <_val_> no output on stdout
[11:41:36] <altendky> _val_: share code and output
[11:42:14] <_val_> altendky: I copied and pasted your code
[11:42:20] <_val_> now running ./yourcode.py
[11:42:28] <_val_> I get a new line with no output
[11:42:42] <altendky> _val_: it isn't meant to be run directly. i made a function you could call which would _return_ a list of strings which are the host names
[11:43:02] <_val_> Oh yes hold a sec
[11:43:17] <altendky> returning and printing are entirely independent things. one is for communicating to the user, the other is for communicating to the function that called you
[11:44:35] <_val_> altendky: well yeah I was confused.. I sometimes think python is a total weird beast
[11:45:43] <_val_> altendky: now is the thing to get addItem+=(...) or something.. so when this function get_hosts is called,.. it will fill the items in the combobox
[11:46:10] <altendky> _val_: i would do something more like `the_combobox.addItems(get_hosts())`
[11:46:19] <_val_> g
[11:46:36] <_val_> ok
[11:46:38] <altendky> _val_: what if you just wanted to get the hosts and print them? it's nice to have small pieces that you put together
[11:46:53] <altendky> rather than having get_hosts only able to 'output' to a combobox
[11:50:01] <_val_> altendky: I want to have the hosts in a list(combo box).. then on selection I want to do something else
[11:50:06] <_val_> but first steps first
[11:50:33] <altendky> _val_: sure, there are a couple 'changed' signals on the combobox you could connect to
[11:53:16] <_val_> http://sprunge.us
[11:54:46] <_val_> I got the example for a combobox from the tutorial mentioned above
[11:56:09] <altendky> _val_: have you gone through a tutorial covering classes? all methods must take self (except for @classmethods which aren't particularly common and @staticmethods which mostly shouldn't exist). and to access methods you have to `self.method()`. but, get_hosts probably just shouldn't be a method. move it outside the class
[12:00:09] <_val_> altendky: hmm but this is complex..
[12:00:16] <_val_> See... the ovirtsdk wants /usr/bin/python
[12:00:23] <altendky> _val_: no, ignore that
[12:00:28] <_val_> th pyqt wants /usr/bin/python3
[12:00:34] <_val_> altendky see http://sprunge.us
[12:00:45] <_val_> super().__init__()
[12:00:45] <_val_> TypeError: super() takes at least 1 argument (0 given)
[12:00:51] <altendky> _val_: i don't even put a shebang like that in my code anymore
[12:01:04] <altendky> _val_: yes, keep running as python3
[12:01:16] <altendky> _val_: though, you ought to be working in a virtualenv or venv
[12:01:40] <_val_> altendky:
[12:01:46] <_val_> import ovirtsdk4 as sdk
[12:01:46] <_val_> ModuleNotFoundError: No module named 'ovirtsdk4'
[12:01:52] <_val_> this is when I run with python3
[12:02:01] <altendky> _val_: yes, you will have to have the modules you import available
[12:02:51] <altendky> _val_: are you working in a virtualenv or venv? what os?
[12:02:57] <_val_> altendky: no
[12:03:09] <_val_> I am on fedora 28 simple terminal
[12:04:09] <altendky> _val_: `python3 -m venv venv` `venv/bin/pip install pyqt5 ovirt-engine-sdk-python` `venv/bin/pip your_script.py`
[12:04:44] <altendky> bit.ly/py-env
[12:09:33] <_val_> ok now I have a venv
[12:11:20] <_val_> getting errors a lot of them
[12:11:24] <_val_> will have a look tomorrow
[12:11:30] <_val_> Thansk for your time and effort
[12:23:04] -!- Afrix has joined #pyqt
[15:04:31] -!- Akex_ has joined #pyqt
[15:27:45] -!- delipickle has joined #pyqt
[15:29:41] -!- delipickle has quit [Client Quit]
[15:29:49] -!- delipickle has joined #pyqt
[15:34:52] -!- swalladge_ has joined #pyqt
[16:24:24] -!- Mrokii has quit [Ping timeout: 252 seconds]
[16:25:50] -!- anqxyr has quit [Read error: Connection reset by peer]
[16:27:13] -!- kushal has quit [Remote host closed the connection]
[16:28:00] -!- kushal has joined #pyqt
[16:41:03] -!- Mrokii has joined #pyqt
[16:41:18] -!- delipickle has quit [Ping timeout: 245 seconds]
[16:54:26] -!- mintograde has joined #pyqt
[16:54:50] -!- Siecje has quit [Quit: Leaving.]
[18:49:52] -!- Afrix has quit [Quit: Leaving]
[20:11:16] -!- frispete_ has quit [Remote host closed the connection]
[20:12:04] -!- frispete_ has joined #pyqt
[20:12:27] -!- stochastix has quit [Ping timeout: 252 seconds]
[20:12:48] -!- stochastix has joined #pyqt
[21:07:15] -!- TurBoss has quit [Ping timeout: 250 seconds]
[21:08:45] -!- hazzy-m has quit [Ping timeout: 276 seconds]
[21:10:04] -!- TurBoss has joined #pyqt
[21:17:54] -!- JanC has quit [Ping timeout: 252 seconds]
[21:22:02] -!- JanC has joined #pyqt
[21:26:14] -!- _val_ has quit [Ping timeout: 250 seconds]
[22:01:16] -!- thomasross has quit [Remote host closed the connection]
[22:01:39] -!- thomasross has joined #pyqt
[22:08:30] -!- thomasross has quit [Ping timeout: 252 seconds]
[22:11:33] -!- Mrokii_ has joined #pyqt
[22:14:13] -!- Mrokii has quit [Ping timeout: 245 seconds]
[22:14:13] Mrokii_ is now known as Mrokii
[22:19:34] -!- thomasross has joined #pyqt
[22:29:34] -!- mandeep has joined #pyqt
[23:37:58] -!- mintograde has quit [Ping timeout: 245 seconds]
[23:59:50] -!- kallesbar has quit [Quit: Konversation terminated!]