« first day (4432 days earlier)      last day (499 days later) » 

12:03 AM
by using SetWindowLong from win32 (python module) + windows extended style, such as WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX you will be able to prevent the window (a specific window handle) from resizing.
 
12:29 AM
@Aran-Fey did a MRE, works when I tried it, but I don't have a game on hand that does the same thing yet :/ (I do recall this happened to me before at least): gist.github.com/secemp9/d473194cc299576acbb0a12320ef3f67 (make sure you change the title and have the said window open to test)
also, I didn't make it go back to its original attributes, so I'm leaving this as a todo on my imaginary list...so you might have to reboot. Just FYI
I didn't look up all of the attributes docs, but I think WS_SIDEBOX is both WS_MINIMIZEBOX and WS_MAXIMIZEBOX. You can probably remove that from the code since I think the only three culprits that work in preventing resizing are win32con.WS_THICKFRAME, win32con.WS_SYSMENU and win32con.WS_OVERLAPPED
so the one you want is hiding in one of those three.
NVM, using just win32con.WS_THICKFRAME is all you need, you can remove the other stuff I added between (); in the gist. Just tested it, and it also, turns out that either way, you don't need a reboot or reloading the attribute...they go back to their original state if you just reopen them
 
 
8 hours later…
9:11 AM
@NordineLotfi Doesn't change anything :(
 
:/ I guess the only way would be to find a game that has a similar problem and fix it locally
I used to play a lot back then, but now I don't even recall much of them
I did find this though while I was making this MRE yesterday: github.com/SpecialKO/SpecialK
this support a bunch of stuff for forcing resolution, etc. Don't know if this relevant here though
 
9:34 AM
> Lovingly referred to as the Swiss Army Knife of PC gaming, Special K does a bit of everything.
Cool. Will you tell me what it actually does, or...?
 
I'm actually not fully sure of all the features it has. I guess you need to install it to find out :|
 
Even after downloading it I can't find any settings except for a "disable" checkbox
 
9:53 AM
hmm, this is weird
there seems to be a faq and two entries for different installations/setups, here and here
 
I've seen those, but I can't find anything useful to click in the GUI
 
10:30 AM
@Aran-Fey ehhehe tell that to the occasional 1x1 px LibreOffice window on my linux
 
Wow, how does that happen? O.o
 
you can easily have 1x1 even on Windows, but it doesn't work for everything. For Pygame for example, I can set it to that, but it won't actually be really useful. For tkinter, you need to use the override(True) option, otherwise, it has a resizing limit
I used LibreOffice a lot though, but never noticed that happening.
 
also another fun thing is occasionally I launch LibreOffice from my terminal... well... if I happen to have a virtual environment activated, Libreoffice will crash [picard.gif]
 
related: bugs.documentfoundation.org/show_bug.cgi?id=104878 I never used gif in LO before
 
11:06 AM
I have a Yolov5 model, it finds the trays in the image, and in a separate place there will be a keras classifier that classifies whether the tray is dinner or breakfast. How will the two models work at the same time? I couldn't find what to use for the merge operation.
Image ->(Yolov5) Tray Detective -> (keras classification fine tuning) dinner or breakfast
 
11:28 AM
So both models get the same image as input? Or does the 1st model find the trays, and the 2nd model only gets the trays as input?
 
@AnttiHaapala--СлаваУкраїні I just recalled now, but this might be because LibreOffice comes with it's own python version bundled. Maybe it crash because of that
 
yolov5 finds the tray in the image.In yolov5, I cropped the trays with --crop, created a new dataset.
 
Which is used as input for the 2nd model?
 
I will classify with the keras classifier with the new dataset created.
 
So the premise of the question is wrong then: you don't want them to run at the same time
 
11:35 AM
i will show sample images
 
@Aran-Fey can you give me one application where you see the "resizing problem" happen? I managed to find a game with a resolution low enough to notice it resize classicshell but would prefer if it's a normal windowed application
 
VSCode
The game in question is Icy Tower 1.3, if you want to know
 
@Aran-Fey hmm, but it's in windowed mode only? there no resolution option in that game AFAIK
 
there's a fullscreen option
 
11:45 AM
but where? I just went to the options but there only one for switching floors or character
 
The goal is to find the food in the image. Since the food is inside the tray, there is no need to look outside the tray. Runs faster if it looks at the tray first
 
nvm, it's in the gfx options
 
@OceanWaves I get that. I just don't understand why you said you want to run the models at the same time. You want to detect the trays first, and then classify them. Where's the problem?
for tray in find_trays(img):
    print(classify_tray(tray))
Isn't that all you need?
 
really?
 
?
 
11:50 AM
my yolov5 model is in a separate place
separate place in keras classification
 
"place" meaning what? Function? Module? Repository? PC? Country? Planet? Universe?
 
colab, jupter notebook
or anaconda environment
 
Either way I don't see how that's relevant. No matter where it is, you have a way to run it. So run it. Where's the problem?
 
@Aran-Fey yep, had to disable fullscreen optimization in the properties -> compatibility, but managed to reproduce it with Vscode as you showed in the screenshot
 
like calling individual functions from main
 
11:56 AM
What's the end goal here? You want to create a function classify_image(img) that returns either "breakfast" or "dinner"?
 
The target will find the food on that tray and tell you the prices.
breakfast and dinner are different. Dinner(soup,meat,fishes,sweet,...)
Breakfast(olives,chesse,tea,jam,omelette)
If the tray is in the evening, it does not look for breakfast products.
tries to find main course and soups
 
Ok, detecting individual food items is out of scope for now. Let's stick to just finding trays and classifying them. Which means you need code like this:
for tray in find_trays(img):
    print(classify_tray(tray))
What is stopping you from writing that code? Can you write the find_trays function? Can you write the classify_tray function?
 
divide and rule the problem ,my teacher said so
@Aran-Fey yes i will try it.
I don't need to use anything else. I didn't know that. I understand better now.I'll just call functions. Thanks a lot:)
 
12:31 PM
stackoverflow.com/questions/74675515 I marked this as a typo, but is it perhaps duplicating something?
I can clearly see the problem in OP's code, but I'm not sure how to characterize it.
 
Regular expression question. I have these two strings:
```
8.45000000001PRO
8.4500000000CAP
```
I want to separate the number from the name of the currency. The issue is that the name is not always just made of letters. In the example above, for example, the names are "1PRO" and CAP.
I made this regexp:
`re.compile(r'([\d\.,]*)(\w+)').match("8.45000000001PRO").groups()`
But it doesn't work, because it matches only "PRO" (without the leading "1"). Can anybody help me understand what's the issue?
 
Well, why would it match 1PRO? \d* matches as many digits as possible, so after that there's only PRO left
 
Exactly. How can I make the \d* "lazy" and set "1PRO" as a special case?
 
This doesn't seem like a problem for regex. What's the pattern that would let regex know that the 1 is part of the currency?
 
I was thinking of something like
r'([\d\.,]*)(1PRO|\w+)'

but it also won't work
I suppose that I'm looking for a way to tell that, if "1PRO" is at the end of the string, I want that to be matched. Maybe it's a matter of lazy/greedy matches, but I can't figure it out
 
12:45 PM
Is the number of digits always the same? If so, you can just chop off the first 12 characters
Or the first 10 characters after the comma
 
Unfortunately I don't have a way to know that. That's why I'd like to have more flexibility
 
@KurtBourbaki Yes, the \d* is too greedy. Unfortunately the solution isn't as easy as just adding a ?, since \w also matches numbers. You have to ensure that the 2nd group only starts matching at the first letter, like ([\d.,]*?)(1PRO|[A-Z]\w+) for example
 
That's interesting. So in this case I would need to add all "exceptions" (names that start with a digit) manually. That seems to be a good compromise for me right now.
Thank you a lot @Aran-Fey
 
1:03 PM
I managed to reproduce it with both Google Chrome and VSCode. Now what I showed using the attribute I mentioned earlier didn't work with VSCode (for some reason, either because of administrator permission or something else) but it did work with GoogleChrome. However, it didn't prevent the game from resizing either of those windows. So instead, I went and tried minimizing every "real" window: gist.github.com/secemp9/37bc3f7de09f69694870e1d255481b99 @Aran-Fey
it works when minimizing all (real) windows, pressing the Super/Windows key, going to the game, pressing the Super/Windows key again, and going back to the desktop.
Mind you, if you want to automate that, you might want to save the states of each real window before minimizing them (so you know which one to unminimize) but otherwise, it's working I think
 
So I run the script, launch the game, exit the game, and then manually un-minimize all the windows?
 
the line that does this is at gist.github.com/secemp9/… and also, it doesn't need namedlist installed, since it work as is with namedtuple (see top comment)
yep
but as I said, you can easily automate all of this
if it works for you, I can try making another MRE that automate this (especially since I can now reproduce it on my end, as mentioned earlier)
 
Well, the thing is, it doesn't work if I automate the last step (unminimizing)
 
but why? just save in a list or something the state of each opened window (eg: are they unminimized?, etc) and then apply them when you alt+tab or exit the game?
 
It's also annoying because unminimizing a window automatically focuses it
 
1:15 PM
ah yeah, I think I know what you mean.
 
So I've solved the problem by saving (and restoring) the size and position of each window
@NordineLotfi I don't know why. I've added time.sleep()s, I've verified that the windows get minimized, I've verified that the resolution is back to normal before unminimizing, but for some reason they still get messed up
 
hmm, I'll try to make another MRE, because I admit this is weird
you're also on Win10 right? which one do you use? IntelHD/Nvidia/AMD?
 
AMD integrated graphics. And yes, Win10
 
alright
@Aran-Fey do you want it to fix the other windows "state" after you exit the game, or when you alt+tab/press super/Windows key?
 
After exiting
 
1:50 PM
I'm trying to check if a number a is within the range b to c (inclusive). I'm not sure whether to use b <= a <= c or a in range(b, c + 1). Can anyone shed light on which may be better and why?
 
I'd say b <= a <= c is more readable
And also works with floats
 
Ah yes, that's a good point
Thank you
 
2:13 PM
Huh, interesting. Wonder why mine didn't work then
 
I noticed that if you use anything less than 1 second with time.sleep, it still works, but the editor/whatever you use that execute this doesn't get restored to its original state, since it gets minimized too soon, and that get registered in the dict total_windows
 
I see you used ShowWindow to minimize the windows, while I used CloseWindow
And then OpenIcon to un-minimize
 
I see :o That might be why then. Btw, it doesn't handle the order of the windows, so I think this is why the editor (as I mentioned earlier) isn't in front.
need to support this too I think
actually it can if I just use a list instead of a dict
also another thing I noticed, instead of minimizing every windows, you can also unmaximize every maximized windows, and it seems to work too.
then you just maximize the one that were maximized after it quit
 
Oh yeah, I didn't notice because I only have 1 window per desktop, but the z-order gets messed up
 
2:28 PM
yeah
seems like using this works: stackoverflow.com/q/6381198/12349101
the last snippet in the OP post
 
Neat, thanks
 
you'd need to apply the zorder from the result of the above on the get_all_windows function on the snippets I posted, because the one with the zorder return even "hidden" windows, while the other one return only real windows but in the wrong order.
 
 
1 hour later…
3:46 PM
@Aran-Fey don't know if you've already added support for zorder, but did it anyway: gist.github.com/secemp9/78c08da2aab5ba5b7641bbc725f0b85f at gist.github.com/secemp9/…
because the next call work the same way as on pure python, it's hard to both check for real windows and using this, so I had to do it this way (you might find a better solution however)
on a side note, I managed to find a nice example for using COM for LibreOffice/OpenOffice: pbpython.com/windows-com.html might as well support this, with the buggy pyuno abomination I made last time
 
 
2 hours later…
5:24 PM
ah, forgot to add this: just edited the last gist above for z-order support, because I recalled that you have to reverse the list using [::-1] as seen here
 
I had a couple of problems (for example, I tried to minimize a window while I was inside of the z-order loop, which caused it to stop halfway), but I finally got it all ironed out
 
@Aran-Fey I see :) do you mind posting a snippet of how you handled the z-order? I don't think the way I did it above is the best, so I'm curious
 
It's pretty much the same really, haven't found a better way to do it
def iter_windows_in_z_order():
    # ! Don't give the user a chance to change the z-order while we're looping
    window_handles = []

    hwnd = user32.GetTopWindow(None)
    while hwnd:
        if _is_app_window(hwnd):
            window_handles.append(hwnd)

        hwnd = user32.GetWindow(hwnd, GW_HWNDNEXT)

    return map(Window, window_handles)
 
ah, got you :o
I think you saw it already, but I think I had to reverse the list on my end for it to work. Don't know why yet
 
5:42 PM
Because it gives you topmost window first, and un-minimizing activates a window. So you have to un-minimize that one last
 
oh, didn't think about that. Nice catch
btw, are you perhaps making a game manager/launcher? at least this is the impression I have
 
A game launcher, yeah. Mostly for games that don't respect my colemak keyboard layout
 
nice, I wanted to make one on Linux, mostly since I liked how Lutris worked, but wanted to make my own. Didn't do it yet
 
 
3 hours later…
8:41 PM
Uncovered an external HDD that I haven't used since 2014. It's gone through numerous house moves with me, so bashed about, and I almost forgot about it. Plugged it in to Windows 10 and it spun up just like new!
 
It has a windows image backup on it which might even be Vista. My laptop is meeting its relatives
 
A long awaited family reunion indeed
 
 
2 hours later…
10:45 PM
Morbid curiosity on my part just to keep myself entertained by homework problems but is it possible to get user input without input? Google searches are swamped with trash that I can't seem to search around
 
It doesn't sound like imports are allowed, which would let us read from sys.stdin
>>> __loader__.__class__.set_data.__globals__['sys'].stdin
<_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>
There it is
 
Does your smurf fancy a quick upvote? It's not possible
 
if I had a potato whenever someone on SO said "X is impossible", I would have a lot of them.
 
I'd actually fancy some downvotes, I've got a bit of a scary amount of rep
 
Well that spoils my hope for a bit of fun :(
 
10:58 PM
at least this can be starred, so there you go
 
Stuff like this also gives me insight into the data model a bit more, so I don't leave empty handed either way and I guess Aran got his 30 seconds of conundrum to solve :P
 
11:24 PM
Feel free to post it yourself, if you don't mind looking like a genius and also a psychopath at the same time :P
 
I don't know, I wouldn't post it given I can't even fathom the magic inside of this (yet). I even credited you Aran, on one of my repo, as a class magician.
OOP is too complicated for me, as of right now, circa today, right now. Maybe it won't be later, but this now is the case
 
Nah, I was just the agitator for a bit of fun. I wouldn't have found that myself so it would be a bit disingenuous and, worse... what if a stronger agitator turns up? :P
 
@NordineLotfi Since you've gathered some experience with this topic, do you happen to know if there's a way to tell if a minimized window was maximized? That was one of the bugs in my code; I thought OpenIcon() would restore the window to how it was before, but no, you have to remember that it was maximized and ShowWindow(SW_MAXIMIZE) it manually
 
hmm, that's a good question. right now, the first thing I can think of is as you mentioned, saving the fact it was maximized or to be general, it's previous state. I don't know if Windows have a history/somewhere it save previous state for windows, but this is worth looking into
The other ways, but probably not what you want I think: 1. Using threading, and periodically checking the state of windows, 2. using a while loop/blocking loop that does the same thing as (1), 3. using a Windows hook, this is related: stackoverflow.com/a/19138080/12349101
the 4 is what we both know already (saving the state somewhere), but aside from that, that's what I can think of right now.
on a side note, I also found this: stackoverflow.com/a/56957832/12349101 which might be a possible alternative to what we did earlier.
another answer, related to (3): stackoverflow.com/a/27404003/12349101
 
11:56 PM
What I want is, given a minimized window, predict what will happen when I click on its taskbar icon: Will it be maximized or not?
 
so you want to detect whenever (following your example) you click on its taskbar icon, and say, print what will happen depending on its windows attribute?
 

« first day (4432 days earlier)      last day (499 days later) »