« first day (2448 days earlier)      last day (2492 days later) » 

2:00 AM
How can I display a PNG image with alpha channel (transparent) on the screen on top of the window system, maybe with using a window that completely transparent background, border, title bar, etc.?
 
 
1 hour later…
3:27 AM
Hi guys. Are any of you knowledgeable of Twilio and Requests packages?
 
3:59 AM
anyone willing to help me troubleshoot an issue with an assignment I'm having? My code seems to check out, but I keep failing for exceeding a time limit that I can't replicate locally (not even getting close to time limit), even with stretching the problem constraints
 
4:48 AM
cbg
 
user8167727
Hi Guys;I Created to spam accounts. Stack overflow Didn't tell not to create spam accounts.I was Unable To Upload My Question. Don't You Think That Is A Bug? Stack overflow Should tell Not to create spam accounts.
 
6:16 AM
cbg
 
 
1 hour later…
7:38 AM
cbg-ning
 
OCP (Oriented Cabagge Programming)
 
8:33 AM
First time for everything: a pissed off user organizing downvotes.
 
8:47 AM
Two downvotes is hardly a conspiracy.
 
Instant -2 does raise an eyebrow, though not much.
 
9:39 AM
@IljaEverilä there are twat everywhere. This dude, he flagged himself and put his picture in his profile and even worse, his name !
massively stupid
 
9:50 AM
I did kind of steal the show, so perhaps they had a right to be a bit irate.
 
10:03 AM
import hashlib

username = 'mypassword'

hash_object = hashlib.sha256(b'USERNAME')
hex_dig = hash_object.hexdigest()

print(hex_dig)
that's the code im troubling with, i want the username variable to go into the hash_object = hashlib.sha256(b'USERNAME') line but i cant do it, .format wont work and i have tried a lot more. does anyone know a fix?
 
I wanted to comment on this post that it doesn't just work with python 3 - at the least it works with 2.7 too - but I don't have enough rep to comment :-P. So maybe someone else can comment if they think it'd be a helpful thing to note? stackoverflow.com/a/30956145/8131703
 
cbg
You know the read and write feature of python
Can you make a new file with it or does it have to be preexisting?
 
@IljaEverilä even if Ilra. It is just an answer... at least, that's how I see it
 
10:20 AM
@FluffyMe first of all, this is not the proper way to use passwords. See passlib instead. Second, hashlib.sha256 takes in a bytes object, so you need to encode your unicode string, preferably to utf-8, thus: hashlib.sha256(username.encode()).
but I repeat: this is a totally incorrect way of handling passwords and you should rather store your passwords in plain text so that you wouldn't pretend you're being any more secure...
... use passlib instead
 
@AnttiHaapala how are you? I'm struggling with this question for days: How can I display an image on the screen with transparent background? I'm looking for a result equivalent to the result of this command: pqiv -c -i image_with_alpha.png Could you help me?
 
You know the read and write feature of python
Can you make a new file with it or does it have to be preexisting?
 
read and write are methods of file objects. How are you gonna call them without a file?
 
@AnttiHaapala Also is there a way to display the image without blocking mouse events? I mean, I would like to be able to click things behind the image. Imagine that we are displaying the image like a watermark on the screen. Is there a way to do that?
 
Is there an echo in here?
 
10:25 AM
You can create a new file with open.
 
Oh but where does that create it? In the same place as the code file?
 
Thanks
Its just I am making a file writing thing in my password thing
Another question: In Tkinter what do you use to make the window fullscreen?
 
10:47 AM
I swear to god, if we get any more easily googleable questions I'll start posting links + number of seconds it took me to find them
 
cbg
Jun 22 at 11:47, by Andras Deak
@Jake the fact that this is the third time Rawing said <the same thing> to you, I must ask you to read and understand this page.
Jun 22 at 11:54, by Andras Deak
but don't worry about it too much, just make sure to make the best of the help you get in the future
asking here instead of google is in no way good use of the help you can get
 
@Rawing Sorry
In fairness to myself the question about the files I tried googleing and nothing came up
 
you need to step up your google-fu, my friend. 2nd result on google for "python create file": stackoverflow.com/questions/35807605/… 2nd result on duckduckgo: pythonforbeginners.com/files/…
 
2nd? What is this magic!
 
K thanks
 
10:54 AM
yea I know, I'm one of those people who use google wrong. I look at more than the first result. Sometimes I even find myself on the 2nd page of results.
 
the where?
you keep saying these words but they don't make any sense
 
oh, sorry, sorry, my bad. You see, it's a magical place that can only be reached after scrolling down all the way to the bottom. It's a long journey, and not many people have made it there. And to make things worse, it often doesn't even have the answers you're looking for. That's why only very desperate people have ever gone there.
 
11:18 AM
Why does the side part of the pack() feature not work?
like when you do self.pack(side=RIGHT)
 
what's it doing wrong?
if you're wondering why it's adding the widget on the left, then I'm afraid you've misunderstood the pack geometry manager
 
@Jake ("side" in that context is called a keyword argument, or kwarg for short)
 
11:39 AM
So I have to use the kwarg** command or something?
**kwargs
:37880229 Didn't see that
Oh well Don't know if that's a good thing or a bad thing
 
@Jake no, no, I just told you how it's called
 
Sorry, I still don't understand. :(
 
"side keyword argument of the pack() method" sounds easier for others to understand :)
it's just jargon
 
So if I want it to be on one side what should I do, I do not follow
Wait let me try something
 
my remark has nothing to do with your actual problem, that's why I put it in parentheses
 
11:46 AM
rbrb
 
rbrb
 
cbg
Right so I Have made a scroll bar for my text box but I first need to get it on the right side then I need to link it to the Text box
Do you follow?
Actually I think I know how to link it let me just try that. rbrb
 
cbg
two more votes or a beautiful hammer
 
Right so I tried linking them but I don't think that will work until I get it on the side
So what is saying is RIGHT is not definded
Anyone follow?
 
@Jake care to copy an exact error?
I suspect NameError: name 'RIGHT' is not defined
 
11:58 AM
Yes Thats Right
 
RIGHT is probably a name in the tkinter namespace
 
File "D:\Tkinter_Final\Secure\Password_Final.py", line 143, in __init__
self.textbar.pack(side=RIGHT, fill=Y)
NameError: name 'RIGHT' is not defined
 
are you using a proper IDE that helps indicate these things to you while you are programming?
 
if you didn't from tkinter import *, which is a good thing not to do, you'll probably need tkinter.RIGHT or Tkinter.RIGHT, depending on python version
>>> import tkinter
>>> tkinter.RIGHT
'right'
python doesn't have a built-in name called RIGHT
 
Cool I will try that
 
11:59 AM
tkinter does
@Jake you don't need the import...you'll have imported tkinter already by some name. Right?
 
yeah I have it as import tkinter as tk btw it works now though, Thanks :)
 
(so you need tk.RIGHT)
no worries
 
rbrb
 
12:26 PM
Unpacking list values to a text seems very "wooden desk" to me. OP seems to have turned a DataFrame into a list, then wrote that list to a file (?), and now wants to read the file and turn it into... Something. A list? A DataFrame? A SQL query?
In any case whatever he's trying to do would probably be easier if he just kept it as a DataFrame to begin with
OP was nice enough to answer my question promptly and with examples, but it only made the problem murkier for me... It's a shame that I can't help this basically decent person
 
sounds very XY
 
How could we categorize this
it's not really answerable. Not sure what to close it as...
pretty much unsupported version
 
How bad are named lambdas if it's really only needed once in the context of a specific function?
 
I think "You can't do this because this library isn't supported on this version of Python" is a reasonable answer.
 
@MorganThrapp if it's needed once, why name it?
 
12:38 PM
readability?
 
but then def
 
named lambda?
 
Because it was becoming multiple lines worth of code. It's being used as a filter.
 
I mean, it would help if the OP had actually included a sentence ending with a question mark in their post, but I think that reply stabs in the general direction of their implied query
 
@MorganThrapp perhaps using a proper function would be clearer anyway
 
12:39 PM
cbg
 
It's just a series of if foo and bar and baz, etc.
 
cbg
 
a series of ifs in a lambda? forget I ever said anything about readability
 
Sorry, only one if, but multiple and.
 
12:40 PM
I myself don't mind assigning lambdas to a variable, even if it is used only once
But I think that goes against PEP8 (and all that is holy)
 
I've made quite a few named lambdas in my day but these days I tend towards nested functions
 
It's not Python, I just trust this room's sense of code style more.
 
def f():
    z = lambda x: x %2 == 1
    return filter(z, range(10))

def g():
    def z():
        return x % 2 == 1
    return filter(z, range(10))
 
Do other languages have style guidelines? I though it was all just a random pile of semicolons and braces.
 
I'm more likely to write g over f most of the time
Assuming that defining it right inside the filter call is out of the question
 
12:43 PM
I want to be that guy and say "use a listcomp instead" but not python
 
Yeah, C# doesn't have listcomps. :/
It has LINQ, which is kinda close, but I still miss listcomps.
 
For enormous lambdas there's always line continuation:
def f():
    return filter(
        lambda x: x %2 == 1,
        range(10)
    )
 
ew
that's worse than a named lambda
 
PEP8 mandates a space after the '%'
(Learning a lot about PEP8 from PyCharm)
 
12:45 PM
Oops. Finger must have slipped.
 
I wonder when programming will finally advance to a point where we no longer treat code as godyam text
 
where everyone can configure their IDE to apply whichever code formatting they prefer
 
There are already an entire class of languages where you construct programs by dragging nodes around and connecting them in a graph. Nobody uses them.
 
Still text-ish
 
12:47 PM
I'm not saying we should stop displaying code as text
just get rid of all the "there should be a space there to make it look clearer" rubbish
 
Mm hmm, I think I know what you mean. A language where you're free to type x%2 or x % 2 but when you save the file they both get stored in the same canonical form. Whether a reviewer sees x%2 or x % 2 when they open the file is not dependent on what you wrote, but what their IDE's style configuration rules dictate.
 
exactly
 
@Kevin I would just as soon write f(), especially if z were named something like is_odd.
 
there's a limit to that, obviously. Your IDE probably won't turn a named lambda into a function for you. But there are plenty of things it could format automatically
 
"avoid named lambdas" is really far down on my list of style rules to obey, just a little bit above "keep all lines under 80 characters"
 
12:50 PM
@PaulMcG That's basically when I'm doing now, with z being isParent.
 
All other things being equal, I'll write a proper function. But all other things are not always equal.
 
Now PEP8 casing is something I do appreciate, especially since I got it so horribly wrong in pyparsing. Should be is_parent.
 
Yeah, I'm a big stickler for casing in Python, this is C# though.
I just like Python's style rules and trust this room's sense of them.
 
Oh okay, so Java-like style (which is actually Smalltalk-like)
 
Yeah.
 
12:53 PM
@PaulMcG or for the Canadians, parent_eh
 
I thought that was a great post the other day.
I had a meeting with a dev team up in Guelph some years ago, and they opened the meeting with the "how did Canada get its name?" joke.
 
and how?
 
"Well, we think it should start with a 'C', eh? And an 'N', eh? Then a 'D', eh? ..."
 
Paul....Paul......sigh....
:P
 
12:58 PM
Perhaps since I've lived in Texas now a while, I should start naming database tables as "AllYallX", like "AllYallStudents" and "AllYallCourses", etc.
 
I'm not being a jerk here right? This individual is throwing confusion out here and wants to talk about it now...I'm not interested
I don't think there is anything else to discuss here. The error message the OP is getting is clear what is happening. You are issuing a new unrelated problem that I am not interested in discussing, sorry. — idjaw 25 secs ago
 
"Canada" is actually Iroquois for "hat of the land of self-aggrandizing people"
 
definitely not a jerk, need to read more context though
 
they aren't even the OP
 
yeah, I gathered that
 
1:00 PM
What a Canada-wearer.
 
@idjaw I don't get it either, but they're probalby wrong
 
they are definitely wrong. They deleted some comments from before
they are not understanding the OP problem
 
the OP problem is that they keep coming and asking
;)
 
Why do OPs have to have so many gat dang problems
 
OK. They deleted all their comments. good. I cleaned up mine
 
1:04 PM
Because neither we nor computers speak OP, that's why they have problems
 
I wish OPs would post "Everything's fine here, how are you" once in a while :'-(
 
lol
No one ever asks how "we" are doing. It's always ME ME ME ME.
Come on OP. Think of us for once.
 
they do, they say "hi how are you" and add "thank you" but then we remove it D:
 
LOL
 
Every time I edit "regards," out of a question, I take a screenshot and print it out and add it to my collage/shrine of regards.
witness regard me
 
1:14 PM
all that time they invested in the greeting, they could've put into writing a better question instead
 
The SO "Elements of Style" also discourages starting your question with "So I..."
 
Rainy Thrusday cbg \o
 
cbg
 
Irritated that Python showing 'ValueError: could not convert string to float' due to '\n' being present at the end of each row got three answers suggesting strip and none of them spent five seconds mentally verifying that spurious whitespace was even the actual issue
 
Will be 97° here today (F, that is - 36.1C for the Fahrenheit-challenged)
 
1:23 PM
-36.1 sounds real cold
 
Yeah
 
but 36.1 sounds like a lot
but then again Texas is paired with "deadly heat" in my head
 
@Kevin "When I open the file in any text editor, it does not show the \n at the end of each row." There is a lot of catching-up to do for this person.
 
21° here
(last week when I had visited Delhi, it was 36°)
 
Also hate screenshots in lieu of copy/paste - although I realize they are trying to show that their text editor is not displaying the \n's
 
1:26 PM
@Paul What's the humidity there?
 
A mere 84%
 
bleh
 
Not sure how to convert that to metric percent, but...
But quite pleasant in my A/C office
rbrb, off to spend some quality time in the temperature/humidity-controlled computer room
 
have fun
 
DSM
2:24 PM
Thursday morning cabbage for all.
 
cabbage
 
cabbage
 
cabbage
 
cabbage
 
recbg
 
2:30 PM
(my user script just saved me, yay @Andras)
 
@poke done
 
davidism kevin'd me
 
perfect
<3
 
DSM
I'm not sure I like the target. It isn't a list-of-lists, and so the logic will need to be type-aware.
 
This latest Travis-CI build for Werkzeug has been sitting idle for 12 minutes now. This delay is awful. travis-ci.org/pallets/werkzeug/builds/248390149
Need to go reduce the number of jobs for Werkzeug like I did Flask.
 
2:33 PM
is it in queue, or just stuck?
I've had "stuck" happen before, and I just restarted it
 
@DSM Added a better target
 
I assume a queue, but usually it starts spinning the little icons by now.
 
DSM
@poke: thanks, that looks better. :-)
 
I love how you can even reorder the duplicate targets
 
OK, going to try restarting.
Yep, it was stuck.
 
2:36 PM
yeah. it happens
Can't remember if I mentioned how I closed off my tox dilemma from yesterday, but I decided to go ahead and be explicit with my envlist.
things work beautifully now and repetition is held to a nice minimum.
 
I did find out that you can use factors in other config keys, like commands.
Werkzeug does it.
 
2:59 PM
Cabbage
@idjaw "that's right....we aren't America's hat....America is Canada's pants." Does that make them the United Shorts of America?
7
 
I'll take it
yes.
 
Over the last couple of days I've received a few votes on old questions, mostly upvotes, but Antti's & my wildcard Any class got another downvote. :(
 
3:16 PM
@idjaw You should mention that str(input()) is redundant
 
@PM2Ring Yes. I actually did not even notice it at all, and someone had mentioned it as a comment. I updated it.
 
@idjaw Don't worry, I didn't notice it at first, either.
 
how did that question get 2 upvotes
 
@Rawing Because it has code, uses coherent English, and clearly describes the problem.
 
From the questions I keep seeing that are of low quality, that actually provided the necessary information to make it a good mcve
concise code. Clear error message. Indication of what is not working, and how they want it to work.
you never get that combination.
I upvoted it
 
3:22 PM
morningcbg
 
morning!
 
fair enough I guess. Me, I couldn't upvote anything that can be solved by reading the documentation about the thing that's "not working" and 2 minutes of debugging
 
You have to keep in mind the wide range of users here. A lot of people coming on to SO as well are new learners, and these concepts don't come as quickly.
Keep in mind these are things we learned as well. Opening and using the debugger is a learned skill too.
4
There needs to be some degree of leniency and guidance here as heavy contributors.
When we see something that has a different level of quality from the bunch, we should support it.
That's my take on it.
 
Yeah, I know. I wouldn't downvote it. But it's far from what I consider a good question
 
Again. Context too. To a future new learner coming in that could be a good question.
we have to put ourselves in their shoes too.
If that user dumped that exact same code and said "it doesn't work"
I immediately close vote
and explain that they need to expand, etc etc
 
3:26 PM
Morning cbg
 
heya!
:)
 
Could one of you guys help me out with this problem?
0
Q: Python SMS Twilio Script Having to Go Through Proxy Wall

Julian RachmanI began using Twilio for Python3 today and I found it quite difficult to even get the first basic script to work. send_sms.py from twilio.rest import Client # Your Account SID from twilio.com/console account_sid = "your_account_sid" # Your Auth Token from twilio.com/console auth_token = "your...

 
@JulianRachman could you read our room rules before posting :D sopython.com/chatroom ?
 
Ok sorry. I will come back in 36 hours
 
Clearly the OP is still coming to grips with how types work in Python, and I assume that Python's their first language. It seems that they're a bit confused that input doesn't return an integer object when an integer is entered (like it does in Python 2)... even though they've wrapped it with str(). ;)
 
3:29 PM
Yeah. We forget how complicated a lot of this is when we first start learning it. There is a lot coming at you at once.
I remember my first C++ course, after only knowing how to write crappy little scripts, and making all my websites using notepad.exe
that yam hit my head hard
 
rb folks
 
rbrb Andy
 
Today I learned that you should spend more than three seconds deciding whether it's a good idea to do "delete reference" in Visual Studio when you're not sure whether the reference is actually being used, and the operation can't be undone, and there are six mutually exclusive dlls on your machine with the same name as that reference, so re-adding the reference requires fifteen minutes of trial and error
 
I did a slightly weird thing the other day, and I can't decide whether it's clever or insane. ;) I was working on code for a Game of Life generator. I have a Cell class to represent individual cells on the grid, and a Grid class that holds cells in a dict called self.board. The program only creates 1 Grid instance. The weird thing is that Grid.__init__ injects self.board into Cell as a class attribute. It works well, but I'm still not sure how I feel about it.
 
3:37 PM
when you run it do you shake your head, or nod your head. That's the first sign to get an indication of how you are feeling
following that. After this initial feeling, do you feel like petting a cat, or burning the world down?
 
@PM2Ring which question? Did not find a link in chat transcript
 
....or both?
 
Hmm, is there a way to use grep so it finds all files that contain the words "widget" and "sprocket", but not necessarily on the same line?
 
I just realized, that PM's quote of my quote put me in a situation to "implicitly" star my own quote.
narcism += 1
 
3:39 PM
I could execute grep twice and parse the output of each, putting the filenames into sets, and then find the intersection, but that's an enormous pain in the butt
 
@idjaw :) Well, I'm quite pleased I thought of it, but I get the feeling that OOP gurus would not be pleased.
Especially when they see that my Cell class uses the Grid.board in a @property which generates a list of neighbouring cells.
 
the horror
:P
@Code-Apprentice s/hear/here/
 
@PM2Ring I agree with much of the previous discussion. A good mcve deserves an upvote, especially for basic beginner questions.
 
@Kevin Sure. Just use a regex of 'widget|sprocket'
 
@idjaw what message does this reference?
Oh... my comment
Autocorrupted
 
3:49 PM
😀 was hoping it would have happened fast enough to delete my call out here in chat.
But...all good 😀
 
I'm tempted to engage in a little more object abuse: I'd like to make my Cells hashable, even though they're mutable, so I can put them into sets. I'll just be using the XY coordinates in the __hash__ (and __eq__) methods, so it should be safe....
 
in Android, 8 mins ago, by Raghav Sood
freed up memory by killing pandas
 
@poke \o/
@Kevin re: PM's suggestion: I usually need to escape the pipe in linux: 'widget\|sprocket'. But if you want to check that both are present someplace, you might have to do something like grep widget filename && grep sprocket filename and look at the return value (in case this is what you need)
actually that would be something like grep -q widget filename && grep -q sprocket filename because the printed output wouldn't make much sense
well, the order of lines would be wrong
 
4:09 PM
@AndrasDeak Good points. I didn't get that both words had to be present in the same file. :) I often use egrep (or the -E flag) to get extended regexes; I find it counter-intuitive to have to escape the metacharacters.
 
yeah, me too, but between grep and sed and vim I gave up trying to adapt :D I just try until it finally works as I intend it
 
Well, with sed you naturally expect it to be insane. :)
 
guys I am dying.
 
I usually avoid using it
 
try to install boost python on windows
 
4:16 PM
@AndrasDeak I have a love/hate relationship with sed. If I'm using it frequently it's ok, otherwise it turns into a write-only language.
 
dying? I suggest you go to the hospital. room 6 is the worst place to come to for medical advice
especially with Andras in the room.
 
@Suisse There aren't many Windows users here at the moment, and I guess none of them have any advice to offer regarding the installation of Boost.
 
FWIW I ended up just manually looking through the grep-for-widget results and eyeballing which files were likely to also contain sprockets based on their filenames, which was good enough in context
 
4:31 PM
Earlier today I was looking for pure Python alternatives to numpy.packbits. I came up with 2 versions, packbits_all converts the whole list into a giant int, and packbits_chunks operates on 8 bit chunks. Somewhat surprisingly, numpy.packbits is only 2-3 times faster than packbits_all and 3-4 times faster than packbits_chunks. Here's some timeit code.
These routines are handy for converting a binary list into a PIL mode '1' monochrome Image and thence into a Tkinter PhotoImage or BitmapImage.
A few days ago I discovered that BitmapImage is somewhat faster than PhotoImage, and it gives you a transparent background by default, although you can easily modify the foreground & background colours at any time. This makes it very easy to create multi-layered images.
 
4:50 PM
I need a book on how to speak with managers :\ Time after time my thoughts don't translate into words that managers understands :\
 
Dr. Dark Souls prescribes a rigorous course of failing a lot until you stop failing
 
only way i can get through those games is to draw enemies out one by one
 
5:22 PM
@idjaw but I'm a doctor!
 
DSM
Aren't we all? ;-)
 
"But Great Clown Pagliacci,", replies the man, breaking into tears, "I am a doctor"
Wait.
The Summer Steam Sale is weakening my resolve in my policy of only buying a new game if I have finished the game I most recently bought.
 
Just make it so that you need to beat 2 games before getting 1 new one. Doesn't matter how old or short they are, just that you've beaten them for the first time
 
5:37 PM
So I beat N games, buy N/2 games, beat those, buy N/4 games, beat those, buy N/8 games... At some point I'll be buying fractional games, which is still possible thanks to Early Access, but nonetheless total playtime will converge to a finite value
 
Once you go below a certain threshold, your backlog is no longer a "backlog" but "some games I still have to play", and you may resume irresponsible buying
But yes, increasingly buying half of the previous amount of games is like playing Zenoblade Saga
 
It doesn't necessarily converge to a finite value, what if the typical game size doubles at the same rate that the number (amount?) of games you buy halves?
 
Anybody here familiar with using docker jupyter/pyspark-notebook?
Having a nightmare getting my local volume mounted inside the container.
 
Dear god, there's a WeRateTypes
Some haters are telling us our ints are 33 bits, but our chars are 11 bits so we're conforming to the standard. We… https://twitter.com/i/web/status/880261064042061824
 
@user1566200 no I have no experience with docker
 
5:46 PM
The world really is full of things.
 
One syntax question10:46
SO I'm trying to import a class that is located in the main function, so that I can use that class somewhere else, how can I do that?
 
Generally, classes should be defined at the global scope, not inside a function.
 
By not putting it in the main function
 
and why are you putting it in the main function
 
#no
def f():
    class Widget:
        #blah
    return 23

#yes
class Widget:
    #blah
def f():
    return 23
 
5:49 PM
It is already there, I'm just adding more to it. I did not write the original code
It would be nearly impossible to change it from the main function, because there are hundreds of lines that would need to be changed
 
Why, does it rely on stuff from that scope?
 
When you say "use", do you mean "instantiate new instances of", or "access attributes and invoke methods of existing instances of"? Because the first one can't be done without a reference to the class, but the second one can be done.
 
please show an mcve
 
There's ways to get around this all but it would be far more brittle and confusing than just moving it to where it belongs
 
Well this is my original question (stackoverflow.com/questions/44831052/…) which has MCVE
 
5:51 PM
def f():
    class Dog:
        def bark(self):
            print("Woof")
    d = Dog()
    return d

def g():
    mydog = f()
    mydog.bark()

g()
g is capable of invoking mydog's bark method even though the Dog class is not visible to g
However, g is not able to create a new Dog. Well, not easily.
 
@Kevin it's more complicated than this. I appreciate the gesture though
 
I'm looking at that post and I don't see any classes defined inside any functions.
 
@Kevin, you mean "any functions defined inside any classes"?
I left the implementation out,because it's unnecessary for this question.
 
No, that's not what I mean. You said you had a class located in the main function. In the question you linked, there is no main function.
I think when you say "function" you mean file or module or something
 
your explanation indicated you had something like this:
def main():
    class Foo:
        pass
 
5:55 PM
@Kevin, sorry I should have been more clear about it. I meant to say: " I would like to access a function or a class, that is located inside a main file, from another file"
 
Ok then. That should be possible using ordinary import.
 
from module import function
from module import class
something like that
 
@Kevin, ok, I'm doing that import gui_main as main
but I keep getting an error
 
Did you print out the contents of frames to verify it is what you think? And try doing that from the other file as well to verify something hasn't changed or isn't being done in the right order
 
if I do: from __main__ import Menu
I get the error:
ImportError: cannot import name 'Menu"
 
5:57 PM
Ok, what kind of error? I don't see an error in your post.
 
They point out both the error and where it occurs
Ah, but not that critical content :)
 
Incidentally I don't think you can say your post has an MCVE and also say "I left the implementation out". The C stands for "Complete" and leaving out code necessary to run the program means it isn't complete
 
@KevinMGranger right
 
show_frame(main.Menu) <- is this supposed to take an uncalled class, or an instance?
because as is it is just the class and not the instance of the class
 

« first day (2448 days earlier)      last day (2492 days later) »