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
Cockmaster
Feb 24, 2002

Tigren posted:

Any hangups making a small web app and then you can design the GUI using HTML5/CSS/JS?

I have no experience with any of that, nor any interest in web design.

Adbot
ADBOT LOVES YOU

QuarkJets
Sep 8, 2008

Tigren posted:

Any hangups making a small web app and then you can design the GUI using HTML5/CSS/JS?

Personally I feel like this kind of move is tacky


Cockmaster posted:

What are some good resources for learning GUI programming in Python? I'll be writing some interface software for a robot - nothing too fancy, just standard off-the-shelf GUI objects. Plus I'd need the code to run on either a Windows 10 system or a Raspberry Pi, so I would assume I'd want to use something like Tkinter or wxPython.

Qt is my go-to for cross-platform GUI development; there are a million resources for learning Qt on the web, and PyQt is just a small extension to that (you're just using Python instead of C++)

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



QuarkJets posted:

Personally I feel like this kind of move is tacky

It's kinda rickety and weird, but for better or for worse the web browser is kinda becoming the lingua franca of UI toolkits.

OK yeah fine probably for worse

Thermopyle
Jul 1, 2003

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

Munkeymon posted:

It's kinda rickety and weird, but for better or for worse the web browser is kinda becoming the lingua franca of UI toolkits.

OK yeah fine probably for worse

IMO, CSS/HTML/JS, while being pretty lovely in a lot of ways, is better than the historical desktop GUI toolkits of yore that Python has been stuck with for decades.

QuarkJets
Sep 8, 2008

Qt is actually pretty great though

Cockmaster
Feb 24, 2002
Qt Designer certainly looks like it'd come in handy. What I'm doing is just complex enough to make manually coding the GUI objects impractical, but the fully-featured APIs make saving and backing up work way too complicated (it might makes some sense for a professional environment, but that's not me).

ahmeni
May 1, 2005

It's one continuous form where hardware and software function in perfect unison, creating a new generation of iPhone that's better by any measure.
Grimey Drawer
React and it's component based arch are super nice nowadays and you get a full build and test system with create-react-app. Coupled with a decent UI library like Semantic-React and you get a very nice and functional system without a lot of effort.

Not to knock QT but unless you have some particular requirements that require a native application then I wouldn't recommend it to those not familiar with it.

QuarkJets
Sep 8, 2008

Cockmaster posted:

Qt Designer certainly looks like it'd come in handy. What I'm doing is just complex enough to make manually coding the GUI objects impractical, but the fully-featured APIs make saving and backing up work way too complicated (it might makes some sense for a professional environment, but that's not me).

Professional or unprofessional, you should have a github account. That makes backing up (and version control) extremely easy

accipter
Sep 12, 2003

ahmeni posted:

React and it's component based arch are super nice nowadays and you get a full build and test system with create-react-app. Coupled with a decent UI library like Semantic-React and you get a very nice and functional system without a lot of effort.

Not to knock QT but unless you have some particular requirements that require a native application then I wouldn't recommend it to those not familiar with it.

There is definitely a learning curve with Qt, but it is essentially another library within Python. Using HTML+CSS+Javascript requires learning three additional languages, as well as UI library.

Dominoes
Sep 20, 2007

Hey dudes, running into issues scraping this image: http://www.feynmanlectures.caltech.edu/img/FLP_I/f16-01/f16-01_tc_big.svgz

Getting 403s, despite having a user agent header. Ie:

Python code:
url = 'http://www.feynmanlectures.caltech.edu/img/FLP_I/f16-01/f16-01_tc_big.svgz'
requests.get(url, headers={'User-agent': 'Mozilla/5.0'}, stream=True)
Any ideas?

FoiledAgain
May 6, 2007

I'm having trouble installing any packages with Anaconda (version 4.2.9, Python version 3.5.2). Regardless of what I try to install, I get the same error message every time. For example:

code:
C:\Users\FoiledAgain\Documents\GitHub\MyProject > conda install cx_freeze
Fetching package metadata.......
CondaHTTPError: HTTP Error: Could not find URL: [url]https://github.com/kylebgorman/textgrid/win-64[/url]
I recognize the textgrid module - it's something I've already installed, and use regularly. But why would Anaconda try to look up that URL, when I asked for cx_freeze (or anything else)?

edit: the forum is automatically adding [url] tags - those are of course not part of the actual error message

QuarkJets
Sep 8, 2008

accipter posted:

There is definitely a learning curve with Qt, but it is essentially another library within Python. Using HTML+CSS+Javascript requires learning three additional languages, as well as UI library.

One of which is loving Javascript; gently caress That

QuarkJets
Sep 8, 2008

FoiledAgain posted:

CondaHTTPError: HTTP Error: Could not find URL: https://github.com/kylebgorman/textgrid/win-64

I recognize the textgrid module - it's something I've already installed, and use regularly. But why would Anaconda try to look up that URL, when I asked for cx_freeze (or anything else)?

Is it possible that conda is trying to update textgrid? You could always try removing it, installing whatever, then installing textgrid again (in case the update URL is hosed somehow)

VikingofRock
Aug 24, 2008




Dominoes posted:

Hey dudes, running into issues scraping this image: http://www.feynmanlectures.caltech.edu/img/FLP_I/f16-01/f16-01_tc_big.svgz

Getting 403s, despite having a user agent header. Ie:

Python code:
url = 'http://www.feynmanlectures.caltech.edu/img/FLP_I/f16-01/f16-01_tc_big.svgz'
requests.get(url, headers={'User-agent': 'Mozilla/5.0'}, stream=True)
Any ideas?

I'm getting a 403 too. Maybe you need to be logged into something to see that image?

Dominoes
Sep 20, 2007

If you click the link above, it'll work. These guys have complained about people scraping the site before, so I suspect they're doing something deliberate; can't figure it out!

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

Dominoes posted:

If you click the link above, it'll work. These guys have complained about people scraping the site before, so I suspect they're doing something deliberate; can't figure it out!

Clicking that link 403s for me. Maybe it would work if you set the referrer header to their site?

FoiledAgain
May 6, 2007

QuarkJets posted:

Is it possible that conda is trying to update textgrid? You could always try removing it, installing whatever, then installing textgrid again (in case the update URL is hosed somehow)

Turns out that I had a .condarc file hanging around with that particular textgrid github page listed. I don't know where that came from, but deleting it solved my problem.

Dominoes
Sep 20, 2007

taqueso posted:

Clicking that link 403s for me. Maybe it would work if you set the referrer header to their site?
That works - thanks much!

Dominoes fucked around with this message at 00:28 on Dec 7, 2016

pmchem
Jan 22, 2010


Had some major frustrations with the Anaconda 4.2.0 Win x64 installer today on win7. Installing just for user without admin, repeated instances of "failed to create Anaconda menus". Then, the uninstaller can't even be run. I have to have an admin execute that for some reason; it does nothing when the user runs it without admin. Maddening. And the uninstaller leaves things like %PATH% appends in the registry, and Python keys in CURRENT_USER/Software/ . I still don't have a working install.

Next time I can grab an admin I'll try to have them run the installer with admin privs, but still install for 'just me' and see how it goes. Anyone else had problems with this, installing as non-admin?

BigRedDot
Mar 6, 2008

pmchem posted:

Had some major frustrations with the Anaconda 4.2.0 Win x64 installer today on win7. Installing just for user without admin, repeated instances of "failed to create Anaconda menus". Then, the uninstaller can't even be run. I have to have an admin execute that for some reason; it does nothing when the user runs it without admin. Maddening. And the uninstaller leaves things like %PATH% appends in the registry, and Python keys in CURRENT_USER/Software/ . I still don't have a working install.

Next time I can grab an admin I'll try to have them run the installer with admin privs, but still install for 'just me' and see how it goes. Anyone else had problems with this, installing as non-admin?

That's weird, I just tried an install of 4.2 on Win7 x64 and it went off without a hitch. If you post details on the Anaconda public mailing list I will try to direct someone to look at it specifically.

pmchem
Jan 22, 2010


BigRedDot posted:

That's weird, I just tried an install of 4.2 on Win7 x64 and it went off without a hitch. If you post details on the Anaconda public mailing list I will try to direct someone to look at it specifically.

It involves a work machine where I can't really post more details than what's in the thread here due to institutional policy and our IT support setup.

I have Anaconda 4.2 on win10 x64 @ home (on my own PC), installed just fine as user. I am at my wits' end as to why it is messing up on my work machine. It had previously installed successfully on the work machine, but I had an admin run the installer as admin even though I installed to 'just me'. Then I did some things in conda like install a py27 environment, which at some point broke, perhaps due to a system update pushed out by our IT. So I was attempting to uninstall/reinstall to get my python fully working again. I thought perhaps it was related to the 1024 character PATH limit, so I attempted an install without the PATH setup checkbox, but ended up at the same error. My username does not have any spaces in it.

I'm not the only one, apparently, lots of google hits from months ago on similar things, such as: https://github.com/ContinuumIO/anaconda-issues/issues/732

BigRedDot
Mar 6, 2008

pmchem posted:

but I had an admin run the installer as admin even though I installed to 'just me'.

I'm not much of a Windows user, but this jumps out at me. I have definitely had the experience on Linux of running an installer or script of some kind as a privileged user, resulting in files in my home directory that I no longer had permissions to change as a regular user.

Thermopyle
Jul 1, 2003

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

accipter posted:

There is definitely a learning curve with Qt, but it is essentially another library within Python. Using HTML+CSS+Javascript requires learning three additional languages, as well as UI library.

On the other hand one of these is a useful thing to learn for the future.

Thermopyle
Jul 1, 2003

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

QuarkJets posted:

One of which is loving Javascript; gently caress That

JS is basically python.

pmchem
Jan 22, 2010


BigRedDot posted:

I'm not much of a Windows user, but this jumps out at me. I have definitely had the experience on Linux of running an installer or script of some kind as a privileged user, resulting in files in my home directory that I no longer had permissions to change as a regular user.

yeah, I checked against that too. Totally nuked the paths of the previous Anaconda install, no issue there. Even got rid of all the settings related paths. As far as Anaconda is concerned, it should be a virgin machine.

I do have Anaconda working fine on my linux box at work.

ahmeni
May 1, 2005

It's one continuous form where hardware and software function in perfect unison, creating a new generation of iPhone that's better by any measure.
Grimey Drawer

accipter posted:

There is definitely a learning curve with Qt, but it is essentially another library within Python. Using HTML+CSS+Javascript requires learning three additional languages, as well as UI library.

I think this is very much undercutting how much work it is to learn Qt. It a UI library, it's own programming and event construct system and even has it's own .ui language. You're still messing about with a layout language in both.

QuarkJets posted:

One of which is loving Javascript; gently caress That

There's a lot of hate out there, which I think generally comes from the point at which JS kind of jumped off a cliff and began constructing a plane on the plummet downwards. But things are cool now. There's:

- New, decent language constructs like quick functions () => {foo;}
- Polyfills to ensure they're supported in older browsers so you can dev for your corporate IE without a problem
- React's component based system that allows you to just write things that do stuff and not worry so much about dumb HTML/DOM nonsense
- An actual working build system with NPM and WebPack and proper testing systems
- UI libraries like Semantic UI means i can pump out useful good looking stuff with minimal hassle

I love Python, it's my main language and I use it every day. But I ran into the same issue with interface development in Python that I did with game development: it sucks to distribute and maintain user applications. Getting useful, quick feedback is a key factor in making UI stuff work well for people and you need an underlying system that makes that easy. There's ways to do this with traditional apps but it's definitely not as smooth as being able to push a blob of packed up content to a browser.

There's downsides too though:

- JS can be difficult to test properly. Scoping issues with globals (argh fetch) and shallow rendering of the JS DOM are tough things to deal with
- the JS language moves quickly
- node is the new php and people are building the same dumb things they did in php in node (dont use node)
- React is a steep learning curve (Qt arguably so as well). There's a lot of material out there but there's a bunch of stuff that trips up newbies (props vs state, component mounting lifecycle)
- Qt's specific things like signals are nice and while there are JS alternatives nothing is first class like Qt (slots, designer, etc.)
- It's not Python: Context switching can be an expensive use of your time and you could be a better Python dev (on the flip side JS is an increasingly handy skill to have)

If I could write Python instead of JS in the browser natively then I would but I definitely do not regret a single second I've spent learning it as a compliment to my Python skills.

accipter
Sep 12, 2003

ahmeni posted:

I think this is very much undercutting how much work it is to learn Qt. It a UI library, it's own programming and event construct system and even has it's own .ui language. You're still messing about with a layout language in both.

I completely agree about GUI programming being difficult and challenging to learn. There are so many aspects to consider, and every GUI library arranges the pieces differently. That said, the nice thing about constructing the GUI in Python is that if you are used to programming in Python then lots of the language, debugging, and distributing are at least consistent. I recently made a pretty simple interface using Flask+HTML+CSS+Javascript and was pretty overwhelmed by just trying to figure out how best to debug the Javascript.

Aaronicon
Oct 2, 2010

A BLOO BLOO ANYONE I DISAGREE WITH IS A "BAD PERSON" WHO DESERVES TO DIE PLEEEASE DONT FALL ALL OVER YOURSELF WHITEWASHING THEM A BLOO BLOO
Has anyone looked at Kivy? It seems more straightforward than most GUI Python things that I've had a quick look at.

FoiledAgain
May 6, 2007

Does anyone have any experience using cx_freeze and/or esky? I'm able to do cx_setup.py build_exe and actually get an .exe, but when I run the exe there's an error related to the the multiprocessing module. This module is definitely imported in my program, it is included in cx_setup.py, and I can even see it being imported in the wall of text that cx_freeze prints. Any suggestions? I'm running Python 3.4.4.

Only registered members can see post attachments!

QuarkJets
Sep 8, 2008

Thermopyle posted:

JS is basically python.

That's technically correct, which is the best kind of correct. Kind of like how a bicycle is basically a Ferrari, your smart phone is basically a supercomputer, or how genital herpes is basically a cold sore

(I'm a scientific computing guy so JS is a total non-starter; but I have messed around with Javascript integration in a Qt application for funsies, which is kind of cool because it makes it not too hard to create your C++ objects from Javascript. But you can also just do Python integration, which I've found is way more powerful)

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



It's becoming more Pythonic, but in a janky JS-y kind of way, and I say that as a front-end dev, so I'm doing mostly JS for my day job and have been for a while now.

For example, they added generator functions at the language level (yay) but they don't have a .map, .reduce, etc specified on them like regular arrays so you can't just write code that works for both without monkeypatching or going through a library :argh:

Thermopyle
Jul 1, 2003

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

Random stream of thoughts incoming...

If you just jump straight down the HTML/CSS/JS* path it can be pretty overwhelming...but then again Qt isn't exactly a straight path either.

To be honest, I'm not sure which path is easier to learn starting from nothing. It's really hard for anyone to really remember what it's like to start out fresh with any of this stuff. I've got a lot of work under my belt on each of these paths so I can't be completely sure about which way is the easiest to start out with. My default position of anyone saying they know which is easiest is a lot of skepticism.

There's a real issue with understanding the flaws of the tools you're used to using if you spend all of your time using them because you just instinctively work around them. This is a part of the reason I try to do projects with lots of different tools in a lot of different languages in a lot of different paradigms. I'm lucky because I'm self employed and usually pick the tools for my projects rather than working for a company working just Python or whatever. I feel like it's really helped me to understand where each of the different languages and paradigms are objectively bad and which flaws that people complain about are actually pretty subjective.

Qt and most Python GUI toolkits are fine and work great for simple progammer GUIs that just get the job done. However, IMO, HTML/CSS/JS is just better if you care about UX and UI and information architecture while at the same time not being obviously harder to learn in the general case than QT.

Like it or not, modern UI/UX/IA ideas and tools are being built for the web. Python just isn't ever going to have the best tools, the best ideas, the best paradigms for designing the best GUI's. This does make me a little sad, but it is what it is.

In the case where you already know QT it's harder to make the case for learning HTML/CSS/JS to do your UI. The only thing I'd say in that case is that you should give some real thought to the future prospects of the different technologies. I'd argue that for many, or even most, HTML/CSS/JS are going to be super useful skills for you to have in the future, so be sure and figure the future value of knowledge when making decisions on the matter.

Of course, learning HTML/CSS/JS is 90% learning JS and 10% learning HTML/CSS which are pretty simple. Also, JS is a very small language that is very similar to Python. I mean, I guess if you don't spend a lot of time across a lot of languages you'll see nothing but the differences, but conceptually they're very close to the same thing.


*I keep including JS, but I've found that, depending on the type of your app, you barely need to do any JS when you're using HTML/CSS as the UI to a local app because a lot of the JS on the web is used to give a UX that (at least in theory) has the responsiveness of a desktop UI. That's not nearly as much of a factor when your server is running on the same computer as your browser.

Suspicious Dish
Sep 24, 2011

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

Munkeymon posted:

It's becoming more Pythonic, but in a janky JS-y kind of way, and I say that as a front-end dev, so I'm doing mostly JS for my day job and have been for a while now.

For example, they added generator functions at the language level (yay) but they don't have a .map, .reduce, etc specified on them like regular arrays so you can't just write code that works for both without monkeypatching or going through a library :argh:

map in Python implicitly converts to an array. If you want that in JavaScript you have to explicitly convert to an array. [...myGeneratorFunc(foo)].map(...)

I think that's a better idea.

mystes
May 31, 2006

Suspicious Dish posted:

map in Python implicitly converts to an array. If you want that in JavaScript you have to explicitly convert to an array. [...myGeneratorFunc(foo)].map(...)

I think that's a better idea.
In Python 3 doesn't map take an iterable and return a generator instance?

Feral Integral
Jun 6, 2006

YOSPOS

Can somebody tell me what I'm doing wrong with this simple re?

code:
asdf = re.findall(r'^.*\[(.*)\].*$', 'asdfas[asdhfjksdaf]asdfas[sadcgfdsfg]asdfasdf')
I keep getting only the first match ['sadcgfdsfg'], rather than what I expect: ['asdhfjksdaf', 'sadcgfdsfg']

Edit:
@LochNessMonster: yep typo, fixed that

@Symbolic Butt: that did the trick, thanks!

Feral Integral fucked around with this message at 19:55 on Dec 7, 2016

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

Feral Integral posted:

Can somebody tell me what I'm doing wrong with this simple re?

code:
asdf = re.findall(r'^.*\[(.*)\].*$', 'asdfas[asdhfjksdaf]asdfas[sadcgfdsfg]asdfasdf')
I keep getting only the first match ['sadcgfdsfg'], rather than what I expect: ['sadcgfdsfg', 'sadcgfdsfg']

Use lazy quantifiers:

Python code:
re.findall(r'.*?\[(.*?)\].*?', 'asdfas[asdhfjksdaf]asdfas[sadcgfdsfg]asdfasdf')

mystes
May 31, 2006

Feral Integral posted:

Can somebody tell me what I'm doing wrong with this simple re?

code:
asdf = re.findall(r'^.*\[(.*)\].*$', 'asdfas[asdhfjksdaf]asdfas[sadcgfdsfg]asdfasdf')
I keep getting only the first match ['sadcgfdsfg'], rather than what I expect: ['sadcgfdsfg', 'sadcgfdsfg']
Greedy matching, and findall doesn't actually give you overlapping matches so you actually need your regex to match each individual section only, rather than the whole string. You may be able to work around this with the newer regex module, but you should probably understand how regex matching normally works instead.

LochNessMonster
Feb 3, 2005

I need about three fitty


Feral Integral posted:

Can somebody tell me what I'm doing wrong with this simple re?

code:

asdf = re.findall(r'^.*\[(.*)\].*$', 'asdfas[asdhfjksdaf]asdfas[sadcgfdsfg]asdfasdf')

I keep getting only the first match ['sadcgfdsfg'], rather than what I expect: ['sadcgfdsfg', 'sadcgfdsfg']

I assume you would like to get:
['asdhfjksdaf', 'sadcgfdsfg']

What you just typed was the 2nd hit twice, so I assume that's a copy/paste error.

Did you try the string without the ^ and/or $? Your regex currently looks for a string that:

-Starts with any character
-Contains / captures all characters between square brackets
- ends with any characters.

Unfortunately I'm phone posting so can't check it myself.

What you could try is something like this too:
code:

.*[\[(.*)\]].*


Edit: beaten like a red headed stepchild.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Suspicious Dish posted:

map in Python implicitly converts to an array. If you want that in JavaScript you have to explicitly convert to an array. [...myGeneratorFunc(foo)].map(...)

I think that's a better idea.

I like the way Py3k and LINQ work better :shrug:

Adbot
ADBOT LOVES YOU

FoiledAgain
May 6, 2007

FoiledAgain posted:

Does anyone have any experience using cx_freeze and/or esky? I'm able to do cx_setup.py build_exe and actually get an .exe, but when I run the exe there's an error related to the the multiprocessing module. This module is definitely imported in my program, it is included in cx_setup.py, and I can even see it being imported in the wall of text that cx_freeze prints. Any suggestions? I'm running Python 3.4.4.



Update on this: The missing "process" module existed, but had been re-named "Process" during the freezing. Making it lowercase eliminated the error. Then I got another similar error where scipy.spatial.ckdtree couldn't be found. Again, this was for some reason re-named cKDTree, and making it lowercase eliminated the error.

Now there are no more errors, but my .exe doesn't run at all. Double-clicking on it causes nothing to happen. Opening it from the command prompt equally does nothing. There are no errors, there's nothing that pops up then closes...it's like double-clicking my exe has no effect whatsoever.

Any suggestions?

edit: forget cx_freeze, it's way too picky. pyinstaller worked on the first attempt.

FoiledAgain fucked around with this message at 21:04 on Dec 9, 2016

  • Locked thread