|
QuarkJets posted:PySide is just Qt, and Qt is a good GUI framework If you include documentation in your definition of "good framework" (you should), PySide is not what I would call good unless you're already familiar with Qt. It's not horrible, it is usable, you can make good GUI's with it, you don't want to die after having used it. Those are all things I would say about it.
|
# ? Dec 29, 2013 03:16 |
|
|
# ? May 24, 2024 20:33 |
|
PySide is not well supported anymore, is it?
|
# ? Dec 29, 2013 04:56 |
|
I'm certainly having success with PySide, I dunno about you guys.
|
# ? Dec 29, 2013 05:28 |
|
Thermopyle posted:If you include documentation in your definition of "good framework" (you should), PySide is not what I would call good unless you're already familiar with Qt. PySide has tons of documentation. There's a full reference guide and an easy to understand guide to understanding how the Qt API is being exposed in Python. All Qt documentation is also PySide documentation after an additional 5 minutes of reading.
|
# ? Dec 29, 2013 05:44 |
|
BigRedDot posted:PySide is not well supported anymore, is it? From the limited amount of research I did, PySide seems to be fractured when it comes to Qt4/5 and usage on Wayland w/o XWayland. This is in context of writing code that can be easily ported to whatever the maemo/meego successor of the month is. PyQt5 solves the Wayland issue, is portable, has documentation, though relies extensively on the Qt documentation (which is excellent). From what I've seen it should be easy to translate between PyQt/PySide code and the Qt provided C++ examples. tldr: if you want py3k, wayland and qt5 supported out of the box, PyQt5 has you covered. Otherwise, PyOtherside takes care of qt5/wayland if that is an issue for you. salisbury shake fucked around with this message at 08:33 on Dec 29, 2013 |
# ? Dec 29, 2013 08:23 |
|
QuarkJets posted:PySide has tons of documentation. There's a full reference guide and an easy to understand guide to understanding how the Qt API is being exposed in Python. All Qt documentation is also PySide documentation after an additional 5 minutes of reading. Lots of documentation is not the same as good documentation. I'm glad you find the documentation sufficient, but I've fielded tons of questions about it over the years, so I do not. The apparent disconnect here is probably partially due to the level of familiarity with GUI programming one would expect out of a documentation reader. Anyway, documentation is just the first issue I pulled out of the hat when coming up with an issue I have with PySide, but as it is still the framework I'm most likely to recommend, I don't see the point in continuing to argue about it.
|
# ? Dec 29, 2013 19:45 |
|
Star War Sex Parrot posted:Hello your av owns. Please post in threads that I read more often. NP; Will do. Content: data analysis is hard. Does anyone know good examples of people scraping data from websites? I'm finding it most helpful to just look at a lot of other people's projects and try to replicate their code.
|
# ? Dec 29, 2013 21:52 |
|
I mean, I have trouble with the documentation sometimes too, but I just attributed that to how little I know of how GUI programming works/general feeling of "what".
|
# ? Dec 30, 2013 02:42 |
|
semicolonsrock posted:Content: data analysis is hard. Does anyone know good examples of people scraping data from websites? I'm finding it most helpful to just look at a lot of other people's projects and try to replicate their code. Gonna swoop in a plug dis SA forums scraper, because I'm sure we'll both benefit from whatever constructive criticism posters can give edit VV This is in response to your last sentence There's a full download of the book if you look. salisbury shake fucked around with this message at 04:04 on Dec 30, 2013 |
# ? Dec 30, 2013 02:56 |
|
I think it's more that Qt is a fairly typical, modern OO GUI framework so conceptually it shares a lot with other modern OO GUI frameworks... so the documentation is good if you already have experience with something else, because you're just looking for how to apply the same concepts that you're already familiar with. But if you're just starting and don't know any of the general concepts or vocabulary, the documentation isn't always super helpful just because you don't know what to look for or how the big picture should look. For that a book or jumping in on someone else's project can get you up to speed a lot faster.
|
# ? Dec 30, 2013 03:48 |
|
I'm trying to merge a Pandas DataFrame and TimeSeries together. (A TimeSeries is basically a column of timestamps and a column of data values, and the DataFrame I'm working with has the same timestamp column with several other columns of data values.) However, neither merge() nor concatenate() worked. How do you "append" the TimeSeries's data column to the right of the DataFrame? edit oh god that was fuckoff simple. ignore me salisbury shake posted:edit VV This is in response to your last sentence There's a full download of the book if you look. Is there a version of this for PySide? I'm looking to start a GUI version of my stocks app and I like this book, but it's only for PyQt. Pollyanna fucked around with this message at 06:39 on Dec 30, 2013 |
# ? Dec 30, 2013 04:20 |
|
Pollyanna posted:Is there a version of this for PySide? I'm looking to start a GUI version of my stocks app and I like this book, but it's only for PyQt. PySide and PyQt are fairly similar. Bigger issues is that this book is over 6 years old. Ill check it out, hopefully general concept didnt change all that much.
|
# ? Dec 30, 2013 08:12 |
|
Zarikov posted:I have been working on and off with python a bit, and I think I am finally ready to start thinking about building GUIs for a program I've been working on. Currently I've been playing with wxPython, but the documentation I've found leaves a lot to be desired... Can anyone recommend me an alternative with better (aka for people not already great at programming) documentation? Or, if wxPython is really worth using, a resource better than the ones their website links to? PySide/PyQt are pretty reasonable to use, I found them documented pretty well, compared to other UI toolkits i've used. The signal + slots model can be a bit annoying to get used to. Some tips: If you're using PyQt — Use new style signals and slots — Use the new apis for QVariants and QString, i.e import sip; sip.setapi('QString', 2) — Don't reattach/detach signal handlers, just pick one and leave it. Signals and slots are tempting to handle state machines, but you've better off writing the state handler yourself. PySide iirc uses new style apis + signals and slots, but it can be fun to test against if you're using PyQt because they're slightly differently implemented and can show different bugs.
|
# ? Dec 30, 2013 12:01 |
|
evilentity posted:PySide and PyQt are fairly similar. Bigger issues is that this book is over 6 years old. Ill check it out, hopefully general concept didnt change all that much. When I did a bit of PyQt + PySide, I spent an awful lot of time in the Qt documentation, and rarely in the former. Note: Qt4 ->Qt5 isn't the biggest leap
|
# ? Dec 30, 2013 12:04 |
|
evensevenone posted:I think it's more that Qt is a fairly typical, modern OO GUI framework so conceptually it shares a lot with other modern OO GUI frameworks... so the documentation is good if you already have experience with something else, because you're just looking for how to apply the same concepts that you're already familiar with. But if you're just starting and don't know any of the general concepts or vocabulary, the documentation isn't always super helpful just because you don't know what to look for or how the big picture should look. For that a book or jumping in on someone else's project can get you up to speed a lot faster. I think this is exactly it, so it boils down to how much you go in expecting documentation to bridge that gap. Like, I go in to the documentation now and have no specific problems with it. I go in to the documentation 5 years ago before I'd ever done any GUI work and it's frustrating.
|
# ? Dec 30, 2013 19:56 |
|
I had a tough time learning Qt. It makes sense now, but a lot of the import concepts like code structure and custom signals are difficult to find info on. Most PyQt tutorials are antiquated. I've found the best source to be the included examples folder. I've worked through several Pandas tutorials, but can't figure out how to set it up for storing historical stock data - or data with more than 2 axes in general. This tutorial is geared specifically towards that - it shows how to pull Yahoo historical data, and open a dataframe with a single stock and multiple attributes. It also shows pulling multiple stocks with a single attribute. I modified one of the calls in that tutorial to read: Python code:
It appears that one-axis panda data is called a Series, 2-axis is a Dataframe, and 3 is a Panel. Is this right? It looks like I can call data like so: df['Close']['AAPL'][dt.datetime(2012,10,1)] Should I pursue this structure to work with data within my program? It looks like another way to crack this is to have a dataframe's value be a series. Ie: There's a dataframe where rows are dates, and columns are stock symbols. Each value is a series of the different attributes, ie 'Close', 'High', 'Low' etc. It seems like a third option would be what happens when you squish a Panel into a dataframe, from this example: Python code:
1 - Panel 2 - Dataframe of series' 3 - Squashed dataframe 4 - Other I'm leaning towards option 1. It loads cleanly from my current 3-axis dict approach: pd.Panel(data) With data as a dict with axis 0 as symbols, 1 as dates and 2 as attributes The resulting Panel shows Items as symbols, Major axis as attributes, and Minor axis as dates. According to Pandas' site, Major axis is rows, and minor is columns. Why is it, by default, reversing axes 1 and 2? The dataframe examples I find show timeseries' with dates as rows. Should I reverse the major and minor axes here to reflect this? If I try to reverse the axes by doing this: data2 = pd.Panel(items=data.items, major_axis=data.minor_axis, minor_axis=data.major_axis) The axes are correctly restructured and the labels are preserved, but all values are replaced with NaN. I'm also looking for words on how to save/load pandas Panels and Dataframes as HDF. I can use something like this to save: Python code:
Python code:
Dominoes fucked around with this message at 21:43 on Dec 31, 2013 |
# ? Dec 30, 2013 20:09 |
|
Merely going by my R knowledge (which I suspect is one of the things pandas was inspired by), the easier way to go is usually to accept the redundancy of using a 2D data frame. Every datapoint gets a line, every dimension a column. The main benefit is that it's really easy to both filter ("get the lines where the following conditions hold") and iterate through (e.g. for plotting). It's less memory efficient, but I doubt you have enough stock data for that to be a pressing concern?
Computer viking fucked around with this message at 04:57 on Dec 31, 2013 |
# ? Dec 31, 2013 04:52 |
|
Hi, I'm super stuck and frustrated with Pyside right now. I can't grasp or find documentation for what I need to do and what I do find is above my knowledge it seems... I'm making a super simple budget calculator app which calculates from an income column, a spending column and eventually with save functionality. It looks like this so far. Now, I have no issues with the UI layout side of things, I have both those columns working with individual grid layouts with each row being those two line edits and the button to remove the row... which is my problem. I don't know how to do that. How do I select a row or even parse through my grid to select the row of widgets next to that button? It looks like I can find widgets with QGridLayout.itemAtPosition(row, col).widget(), but I have no clue how I can tell which button of which row was pressed. Here's some code, I guess. I don't really know what to post because it's not existing code that doesn't work, it's not knowing what to code in to make things happen, so here's everything (linked cause it's 100 lines long.) http://codepad.org/tlEcuVyD I suspect I could either use some kind of parent widget and cycle through child widgets somehow but the PySide documentation makes my brain hurt sometimes, OR use a class to give each row its unique identifier but again I'm not really sure how to play with individual widgets dynamically. Any help would be appreciated. edit: Now that I've had some time to think about it, am I just really overcomplicating everything? Would it be better to have some kind of list or table view with only two QLineEdits where I add entries and with a way to delete lines/rows? Can I even do that? Daynab fucked around with this message at 11:31 on Dec 31, 2013 |
# ? Dec 31, 2013 10:48 |
|
Daynab posted:Hi, I'm super stuck and frustrated with Pyside right now. I can't grasp or find documentation for what I need to do and what I do find is above my knowledge it seems... Python code:
Dominoes fucked around with this message at 14:31 on Dec 31, 2013 |
# ? Dec 31, 2013 13:11 |
|
Just tried PyCharm out and messing around with the Inspect Code feature; it gives me a warning for every time I define an instance attribute outside of __init__. Should I not be doing that? It's just variables that had no reason to exist until a method needed them and would seem like clutter if moved to __init__. (They do get used in multiple methods, which is why they're instance attributes and not local to the methods in which they're defined.)
|
# ? Jan 1, 2014 02:58 |
|
KICK BAMA KICK posted:Just tried PyCharm out and messing around with the Inspect Code feature; it gives me a warning for every time I define an instance attribute outside of __init__. Should I not be doing that? It's just variables that had no reason to exist until a method needed them and would seem like clutter if moved to __init__. (They do get used in multiple methods, which is why they're instance attributes and not local to the methods in which they're defined.)
|
# ? Jan 1, 2014 02:59 |
|
I've encountered enough long-lived bugs caused by assigning to misspelled attributes that I'm willing to accept the clutter of explicitly setting things to None in __init__ (and if you have to set a lot of things to None your class is probably bad anyway).
|
# ? Jan 1, 2014 03:12 |
|
KICK BAMA KICK posted:Just tried PyCharm out and messing around with the Inspect Code feature; it gives me a warning for every time I define an instance attribute outside of __init__. Should I not be doing that? It's just variables that had no reason to exist until a method needed them and would seem like clutter if moved to __init__. (They do get used in multiple methods, which is why they're instance attributes and not local to the methods in which they're defined.) The idea is that it's dangerous if you call those methods if a different order than originally designed for, and then you get attribute errors because you're trying to access an instance attribute that hasn't been defined yet.
|
# ? Jan 1, 2014 03:13 |
|
Other annoying PyCharm instrospections to turn off: PeP 8 spaces around arithmetic operators, and 80-char line limit.
|
# ? Jan 1, 2014 03:14 |
|
KICK BAMA KICK posted:Just tried PyCharm out and messing around with the Inspect Code feature; it gives me a warning for every time I define an instance attribute outside of __init__. Should I not be doing that? It's just variables that had no reason to exist until a method needed them and would seem like clutter if moved to __init__. (They do get used in multiple methods, which is why they're instance attributes and not local to the methods in which they're defined.) I would at least consider moving them into __init__ and set them to None. This makes it easier to understand what your class is doing when you look at it again in 6 months and is what books and experts on OOP recommend you do. I'd also think about whether you should be using instance attributes on this rather than passing the data around as parameters. Generally, in a good design, instance attributes should be data directly related to the data type your class represents and not shortcuts to avoid passing data around as method parameters.
|
# ? Jan 1, 2014 03:18 |
|
Hey folks. I made a little program to automatically rename and copy music files based on their extensions, and then I rewrote a bit of it so that another user can change the naming convention to fit their own weird compulsive music organizing system. Is there any sort of convention for that type of thing? Right now it's something like {ArtistName}/{AlbumName}/{TrackNumber}-{TrackTitle}.{extension}, which lines up with str.format pretty decently, but if there's any standardized way of doing that, I'd like to know what it is.
|
# ? Jan 1, 2014 07:14 |
|
Dominoes posted:I've never used grid layout, so I can't say for sure. Have you considered creating a list of tuples for each item? Instead of adding widgets, append them to this list. Hmm, I can try this but how would I identify which button is pushed?
|
# ? Jan 1, 2014 08:58 |
|
Daynab posted:Hmm, I can try this but how would I identify which button is pushed? You could just write a quick class that is a QPushButton that controls a QLineEdit. Then you're just adding instances of this class, and since the object only knows about its own QLineEdit you don't have to worry about it deleting the wrong one
|
# ? Jan 1, 2014 19:31 |
|
Dominoes posted:pandas -Dramatic reduction in code required. Remaining code's easier to read. -1/3 file size -Dramatic speed increase. Previously took ~20s to load, minutes to save. Now takes 1-2s each. Was also able to use Pandas to supersede part of my interface to Yahoo's API. Coincidentally, the API appears to have (temporarily?) gone down yesterday. Example code: Python code:
Dominoes fucked around with this message at 00:16 on Jan 2, 2014 |
# ? Jan 1, 2014 20:16 |
|
Dominoes posted:I got a working implementation of Pandas and HDF5. I went with Panels. Compared to my previous nested dict and JSON or SQLite setups: Keep updating your github! It has been really interesting to follow.
|
# ? Jan 1, 2014 23:42 |
|
I could use some advice on how to organize classes in a small project. It's a CLI port of a simple boardgame. The structure is pretty simple: each turn consists of a simple choice (same options every time), then the game state updates and the next player gets to choose. I've already coded a Game class that handles the state. It has a list of players as an attribute, and it uses them for two things: as dict keys to keep track of state (e.g., score), and each turn it calls a player's method "choose", which takes the game state as input and outputs the choice. I figured I'd make a Player (meta)class which implements Player.choose, and subclass it into a HumanPlayer variant and various AIs. Easy enough. The only wrinkle is the interface. I'm not sure where to put it. I'd like it to be factored out of the game logic because while this is CLI for now, I'm hoping to make a web interface later. At first it seems like the Player is the right place to put the interface code, because I could make a CommandLineHumanPlayer and later a WebHumanPlayer, etc. However, this doesn't work so well for the AI. If the interface is going to show the AI turns (as opposed to just the updated state when it's again the human player's turn), then the Game instance would have to call a Player.show_another_players_turn method, which seems like a terrible idea (for one, now if there are two human players hot-seating at the same terminal, it prints each even twice. I don't want the Game to have to keep track of what Players are human or not. It just needs to ask the Players what to do). Okay, so make a third sort of object that handles the interface, have game events call its methods to display the result. That works great for output, but now what does the HumanPlayer object do? You can't have a WebInterface instance and a CommandLineHumanPlayer communicating, it seems like there should be some constraint that ties the input to the output. My best idea so far is to make an Interface class that handles all output and input, and a HumanPlayer class that is just a go-between between a Game instance and an Interface instance. So the Game asks each player in turn what to do, the AI players do some calculation and respond with their choice, but the HumanPlayer just relays the question to the Interface and then relays the answer back to the Game. This seems like a problem that's fairly common. Is mine a good solution, or is there a "classic" approach to this that's recommended? SurgicalOntologist fucked around with this message at 05:19 on Jan 2, 2014 |
# ? Jan 2, 2014 05:16 |
|
I don't think that it makes sense to put the interface code in the Player class. I think that it makes more sense to write an Interface class that holds several Player instances. The Player class should handle game logic, the Interface class should handle input, passing input to the player instances, and providing information to the user.
|
# ? Jan 2, 2014 08:45 |
|
Yes, I came to the same conclusion against putting interface code in the Player class. However, if the Player handles game logic (as opposed to just AI logic as necessary), then game logic and game state is represented and updated independently in each Player. Certainly doable, but why not have a Game object that handles game state centrally? Separate the game logic and the AI logic...
|
# ? Jan 2, 2014 14:46 |
|
Is there a way to stop OSX from nuking my god drat python setup every time it patches the loving operating system. I swear to god I'm going to bust a nut if I have to rebuild my setup one more loving time. edit: Oh ok, just reinstalled command line tools and its all good again. gently caress knows what was going on then? duck monster fucked around with this message at 16:25 on Jan 2, 2014 |
# ? Jan 2, 2014 16:22 |
|
duck monster posted:I swear to god I'm going to bust a nut
|
# ? Jan 2, 2014 17:28 |
|
Dominoes posted:I don't think this means what you think it means. I don't know, I get really excited compiling all that fresh new code sometimes.
|
# ? Jan 2, 2014 18:36 |
|
SurgicalOntologist posted:Yes, I came to the same conclusion against putting interface code in the Player class. However, if the Player handles game logic (as opposed to just AI logic as necessary), then game logic and game state is represented and updated independently in each Player. Certainly doable, but why not have a Game object that handles game state centrally? Separate the game logic and the AI logic... Game: handles state and logic. Requests actions from the Player objects. Outputs state to the Interface object. Player: Implements AI for non-human players and passes requests to Interface when human input is needed (and validates that input?). Passes these results back to Game. Interface: Receives requests from Player to get the human's input. Gets the state from Game and displays it like a game board or whatever.
|
# ? Jan 2, 2014 19:15 |
|
Yep, that's exactly what I had in mind with my last consideration on my initial post. I've started working on it, I think it'll do the trick.
|
# ? Jan 3, 2014 01:46 |
|
Dominoes posted:I don't think this means what you think it means. Point taken lol
|
# ? Jan 5, 2014 05:20 |
|
|
# ? May 24, 2024 20:33 |
|
salisbury shake posted:From the limited amount of research I did, PySide seems to be fractured when it comes to Qt4/5 and usage on Wayland w/o XWayland. This is in context of writing code that can be easily ported to whatever the maemo/meego successor of the month is. What exactly is the trouble with Wayland? Qt5 has a Wayland backend like it has an X11, Win32, or OS X backend.
|
# ? Jan 5, 2014 05:41 |