Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

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.

Adbot
ADBOT LOVES YOU

BigRedDot
Mar 6, 2008

PySide is not well supported anymore, is it?

Pollyanna
Mar 5, 2005

Milk's on them.


I'm certainly having success with PySide, I dunno about you guys.

QuarkJets
Sep 8, 2008

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.

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.

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.

salisbury shake
Dec 27, 2011

BigRedDot posted:

PySide is not well supported anymore, is it?
https://qt.gitorious.org/pyside - seems to be under active development, but I can't pull PySide for Py3k from PyPI.

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

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

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.

semicolonsrock
Aug 26, 2009

chugga chugga chugga

Star War Sex Parrot posted:

Hello your av owns. Please post in threads that I read more often.


Thanks in advance.

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.

Pollyanna
Mar 5, 2005

Milk's on them.


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".

salisbury shake
Dec 27, 2011

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

evensevenone
May 12, 2001
Glass is a solid.
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.

Pollyanna
Mar 5, 2005

Milk's on them.


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

evilentity
Jun 25, 2010

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.

tef
May 30, 2004

-> some l-system crap ->

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?
EDIT if it matters, I'm using python 2.7

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.

tef
May 30, 2004

-> some l-system crap ->

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

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

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.

Dominoes
Sep 20, 2007

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:
df = pd.io.data.get_data_yahoo(['AAPL', 'GE', 'GOOG', 'IBM', 'KO', 'MSFT', 'PEP'], 
                               start=datetime.datetime(2010, 1, 1), 
                               end=datetime.datetime(2013, 1, 1))
This returned a panel.

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:
major      minor                              
2000-01-01 a      0.683758 -0.937731 -0.280853
           b     -0.643834 -1.537770  0.025653
           c      0.421287  0.555759 -1.386071
           d      1.032814 -2.277282  0.863937
2000-01-02 a     -1.290493 -0.390201  0.252462
           b      0.787872  1.207122  1.500571
           c      1.515707  0.178690  1.053202
           d     -0.276487 -1.004168 -2.338595
2000-01-03 a     -0.223762 -1.377627 -0.374279
So, which would you use:
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:
store = pd.HDFStore('historical_data.h5')
for symbol in data:
    store[symbol] = data[symbol]
store.close()
I can then access it like this:

Python code:
store = pd.HDFStore('historical_data.h5')	
print(store['GOOG'][dt.datetime(2013,5,5)]['Close'])
store.close()
However, it's doing all this from a pandas hdf5 data type, and I can't figure out how to convert it to a panel or dataframe. The data's no longer accessible after closing the store. Adding 'data=pd.Panel(store)' causes a Panel constructor error.

Dominoes fucked around with this message at 21:43 on Dec 31, 2013

Computer viking
May 30, 2011
Now with less breakage.

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

Daynab
Aug 5, 2008

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? :shobon:

Daynab fucked around with this message at 11:31 on Dec 31, 2013

Dominoes
Sep 20, 2007

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...
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.

Python code:
income_lines = []
income_lines.append((QLineEdit, QPushButton))
You could reference each item by its list index.

Dominoes fucked around with this message at 14:31 on Dec 31, 2013

KICK BAMA KICK
Mar 2, 2009

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.)

Dominoes
Sep 20, 2007

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 ignore that one. HTH!

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
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).

BeefofAges
Jun 5, 2004

Cry 'Havoc!', and let slip the cows of war.

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.

Dominoes
Sep 20, 2007

Other annoying PyCharm instrospections to turn off: PeP 8 spaces around arithmetic operators, and 80-char line limit.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

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.

null gallagher
Jan 1, 2014
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.

Daynab
Aug 5, 2008

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.

Python code:
income_lines = []
income_lines.append((QLineEdit, QPushButton))
You could reference each item by its list index.

Hmm, I can try this but how would I identify which button is pushed?

QuarkJets
Sep 8, 2008

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

Dominoes
Sep 20, 2007

I got a working implementation of Pandas and HDF5. I went with Panels. Compared to my previous nested dict and JSON or SQLite setups:

-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:
    def local(self, symbol, date, attribute='Close'):
        """Return a single value from local historic data."""
        #date works in either string, date or datetime. Prefer date.
        symbol = symbol.upper()
        return self.data[symbol][attribute][date]

    def api(self, symbol, start_date):
        """Load historic data from a web API, and save it."""
        print("API call for hist data on", symbol, "...")
        data = pd.io.data.DataReader(symbol, "yahoo", start=start_date)
        self.data[symbol] = data
        save(self.data, symbol, 'hist_data.h5')[s][/s]


class HDFMan():
    def __init__(self, filename):
        self.store = pd.HDFStore(os.path.join(DIR_RES, filename))

    def __enter__(self):
        return self.store

    def __exit__(self, type, value, traceback):
        self.store.close()


def save(wp, symbol, filename):
    with HDFMan('hist_data.h5') as store:
        store['wp'][symbol] = wp[symbol]


def save_all(wp, filename):
    with HDFMan('hist_data.h5') as store:
        store['wp'] = wp


def load(filename):
    with HDFMan('hist_data.h5') as store:
        return store['wp']


def dict_to_panel(data):
    dfs = {symbol: pd.DataFrame(stock).T for symbol, stock in data.items()}
    panel = pd.Panel(dfs).rename_axis({'c': 'Close', 'h': 'High'}, axis=2)
    panel.major_axis = pd.to_datetime(panel.major_axis)
    return panel

Dominoes fucked around with this message at 00:16 on Jan 2, 2014

semicolonsrock
Aug 26, 2009

chugga chugga chugga

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:

-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 party of my interface to Yahoo's API. Coincidentally, the API appears to have (temporarily?) gone down yesterday.

Example code:
Python code:
    def local(self, symbol, date, attribute='Close'):
        """Return a single value from local historic data."""
        #date works in either string, date or datetime. Prefer date.
        symbol = symbol.upper()
        return self.data[symbol][attribute][date]

    def api(self, symbol, start_date):
        """Load historic data from a web API, and save it."""
        print("API call for hist data on", symbol, "...")
        data = pd.io.data.DataReader(symbol, "yahoo", start=start_date)
        self.data[symbol] = data
        save(self.data, symbol, 'hist_data.h5')[s][/s]


class HDFMan():
    def __init__(self, filename):
        self.store = pd.HDFStore(os.path.join(DIR_RES, filename))

    def __enter__(self):
        return self.store

    def __exit__(self, type, value, traceback):
        self.store.close()


def save(wp, symbol, filename):
    with HDFMan('hist_data.h5') as store:
        store['wp'][symbol] = wp[symbol]


def save_all(wp, filename):
    with HDFMan('hist_data.h5') as store:
        store['wp'] = wp


def load(filename):
    with HDFMan('hist_data.h5') as store:
        return store['wp']


def dict_to_panel(data):
    dfs = {symbol: pd.DataFrame(stock).T for symbol, stock in data.items()}
    panel = pd.Panel(dfs).rename_axis({'c': 'Close', 'h': 'High'}, axis=2)
    panel.major_axis = pd.to_datetime(panel.major_axis)
    return panel

Keep updating your github! It has been really interesting to follow.

SurgicalOntologist
Jun 17, 2004

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

QuarkJets
Sep 8, 2008

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.

SurgicalOntologist
Jun 17, 2004

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...

duck monster
Dec 15, 2004

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

Dominoes
Sep 20, 2007

duck monster posted:

I swear to god I'm going to bust a nut
I don't think this means what you think it means.

OnceIWasAnOstrich
Jul 22, 2006

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.

KICK BAMA KICK
Mar 2, 2009

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...
I'm trying to learn how to think through these kinds of things myself. How about :
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.

SurgicalOntologist
Jun 17, 2004

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.

duck monster
Dec 15, 2004

Dominoes posted:

I don't think this means what you think it means.

Point taken lol

Adbot
ADBOT LOVES YOU

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

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.

  • Locked thread