#user-interfaces

1 messages · Page 51 of 1

silk basin
#

Anyone here experienced with PyQT5? I have a rather simple question just new to PyQT5

sudden coral
#

Yes there are. Just ask your question.

silk basin
#

So I have a Text Editor I am creating, and I simply just need to get the character count inside the text editor. Same thing as Word. As I type a counter adds or subtracts to a number. I just don't really know how to implement it

sudden coral
#

With a QTextEdit widget

#

It very likely has some attribute or function you can use to get the contents of it

silk basin
#

yeah okay so I have used that already

#

and implemented it into the code

sudden coral
#

Can you be more specific on what you have trouble implementing then?

silk basin
#

wordCount = len(self.toPlainText().split(" "))

sudden coral
#

Is it updating the counter that is problematic?

silk basin
#

yes

#

thats the problem

sudden coral
#

Do you already have a label for the counter?

silk basin
#
    def getWordCount(self):
        wordCount = len(self.toPlainText().split(" "))
        print(wordCount)
#

this is the exact def I am using

sudden coral
#

There's a textChanged signal for which you can hook up a slot. And in the slot you can edit the label's text with the newly calculated word count

silk basin
#

Where do you see that?

sudden coral
silk basin
#

I have been looking for something like that for so long. Also when printing wordcount I get a 1

#

in the console and that is it.

sudden coral
#

Are you familiar with the event system in Qt?

silk basin
#

Not really. This is my first ever attempt using PyQT

#

and Python for that matter

sudden coral
#

Events you can subscribe to are called signals. And you implement slot functions which are like event handlers. In other words, slots are the functions that get called when a signal (event) is triggered.

silk basin
#

does it return a boolean?

sudden coral
#

So if you know you're looking for some kind of event, you'd want to check the "signals" section of the documentation

silk basin
#

oh voids

sudden coral
#

And there you can see textChanged. That was my methodology for finding that

#

This is the C++ documentation by the way. void is None in Python.

#

I just use these docs because they're more readable and complete than the Python ones

silk basin
#

Welp, good thing my main language is C++

#

So how exactly do these signals trigger

sudden coral
#

You define a function you want to act as the "event handler" for it. This function will be considered a "slot"

#

Then you need to hook up the slot to the signal, and qt will take care of the rest

silk basin
#

Okay can I use my old function as the "slot"

sudden coral
#

For example my_text_edit_widget.textChanged.connect(self.my_text_changed_slot)

#

A reasonable spot to make that connection would be in the __init__ of your parent widget/main window

silk basin
#

Okay I will give that a shot. Thanks a lot. Still a bit confused but I'll get there eventually.

#

It is simply just getting used to how Python works

#

ignore that blue mark

sudden coral
#

You need to hook up the slot outside the subclass

#

So in whatever is using your textbox

silk basin
#

My Document class, that is exactly where we use the TextBox class

sudden coral
#

You're misusing inheritance

#

There's no need to subclass the text box here

#

Instantiate the object and store it in your class

silk basin
#

Are you talking about Document(TextBox)

sudden coral
#

Yes

silk basin
#

Well then how would I go about using TextBox

#

Goodness I am a mess

#

does super(TextBox, self).__init__() suffice?

sudden coral
#

Do you have a main window widget?

silk basin
sudden coral
#

I imagined it something like this

#
self.central_widget = QtWidgets.QWidget(self)
self.layout = QtWidgets.QGridLayout(self.central_widget)

self.text_box = TextBox(self.central_widget)
self.layout.addWidget(self.text_box)
#

If you want to have keep the Document class separate, then that's fine, but it should subclass QWidget and have its own layout. Then you can add the text box and the counter label to that layout.

#

And the main window can be reserved for "top-level" stuff like a status bar, the file menu, etc.

#

It's more a matter of design. Either way works.

silk basin
#

okay, im a little bit confused but thanks for your help ill try some things out

lethal coyote
#

I'm playing with the idea of figuring out how to diy an additional input device for my PC. One idea is to buy some cheap tablet and write a simple app that would allow me to send keyboard/mouse inputs via USB. That said, my inexperience far exceeds my ambition atm.

After some brief googling, I think I just need to learn and use one of a couple libraries I found, for the tablet GUI side of it. It's the rest I'm clueless on. Anyone have any insight or guidance on how to go about this?

rocky dragon
#

That sounds like something that should have a (better) app available already, unless you want to write it for practice

lethal coyote
#

nah, not quite that level of masochist. and kinda? i found a couple janky looking ones that connect via wifi, and that seem to limit you a bit

warm jewel
#

Hey guys! I have been writing a code using kivy. Here i am trying to take the input from the user in the "EighthWindow" and trying to get that variable in the "SecondWindow" as a label. My approach was to define UN as a class variable and then update when the username is entered. Then i get the updated value of UN in the second class and plug it in. But UN does not get updated. I am new to kivy and the overall concept of classes and objects as well. Any kind of constructive criticism and help is appreciated. Here are the shortened codes:
Python File

class EighthWindow(Screen): 
    username= ObjectProperty(None)
    password= ObjectProperty(None)
    UN=""
    def change_var(self):
        EighthWindow.UN=self.username.text
        print(EighthWindow.UN)
class SecondWindow(Screen):
    n=EighthWindow.UN
    Name=StringProperty(n)```



Kivy file

```<EighthWindow>:
    name:"Eighth"
    username:username
    password:password
    FloatLayout:
        TextInput:
            id: username
            hint_text:"Username"
            size_hint:0.6,9/40-0.1
            pos_hint:{"top":4/5-0.1,"x":0.2}
            multiline:False
        Button:
            size_hint:0.6,9/40-0.1
            pos_hint:{"top":2/5-0.06,"x":0.2}
            text:"Login"
            on_press:
                root.change_var()
                app.root.current="second"
<SecondWindow>:
    name:"second"
    FloatLayout:
        Label:
            text:root.Name
            pos_hint:{"x":0,"y":0.75}
            size_hint:0.3,0.25```
plush stream
#

Hey, quick question, what's the difference between pyqt and qtquick? And which one fit the best for a desktop app with complex effects such as frosted glass themed window, etc

rough isle
#

I need to help with getting a bunch of files (GUI and socket system) working together.
I have 4 files: server.py, client.py, gui.py and main.py.
server.py and client.py are have the code for a console chat system using sockets.
The problem is that the client only receives messages when he submits an input, since input() blocks all the other code from running. Now I'm trying to combine this system with the GUI I created in gui.py. I was told to use multithreading and was provided with the code below, which I put in main.py. (See Image)

gui.py
https://paste.pythondiscord.com/kanuxubeja.rb
server.py
https://paste.pythondiscord.com/igogorohoh.py
client.py
https://paste.pythondiscord.com/yefevinijo.py
main.py
(Image)

#

Feel free to @ me!

trim ibex
#

nix: there are programs that let you take multiple mouse/keyboard and set them to do different things. what are you looking to do with an extra input device?

lethal coyote
#

@trim ibex oh. that could actually help. how should i phrase my search for those programs?
my hands suck, so a lot of shortcuts and macros are difficult, and certain mouse actions are difficult to do quickly/accurately. so, the idea was to have quick access mapped buttons and maybe a touch mousepad for certain tasks.

placid nebula
#

im looking for good guide book or course anything which you recommend about pyqt5

trim ibex
#

well for difficulty with a mouse, try a nice large trackball. you can get a nice touchpad with big buttons pretty cheap too. there are also bluetooth buttons you can get that people use for quiz programs

#

i guess if you have a lot of macros you'll need some good cheap way to have a lot of actions but also comfortable

lethal coyote
#

@trim ibex hmm...i might just end up going for a touchpad with mappable buttons if i don't decide on something by black friday. thanks for the response

trim ibex
#

if you're thinking around black friday there will probably be cheap low power tablets

#

especially near cyber monday

lethal coyote
#

yep. thats what i'm aiming for. i'm pretty cheap, so 2 months is no problem for a good deal

shell sphinx
#

I have some beginners downloading a package I've developed, and they run into common errors when setting stuff like their Python environment, paths, etc. I've made a list of steps for them to go through if they run into some of these common problems.

Where's a good place to put something like a 'Common Configuration Problems' section containing this information on the README.md of our repository?

inland notch
#

Is pyinstaller the best bet for compiling tkinter programs?

plush stream
#

@inland notch yes, it works great with my app

inland notch
#

it doesn't work well for me

#

or at all

#

it just doesn't work

#

@plush stream you familiar with Errno 22?

plush stream
#

Can you screenshot me the error inside the console?

inland notch
#

yee

trim ibex
#

Seligmann you can put it under "installation" or "setup". it's still part of that and it will help bring it front and center.

plush stream
#

@inland notch is this also happened before you compiled the script?

inland notch
#

No, it happens during the compiling

plush stream
#

That's weird, errno 22 is usually connected with directories errors, can you recheck a line of code that tell python to open some file? e.g: File = Open('C:\User\Somefiles')

inland notch
#

Oh it might actually be that

#

if I had another folder in the dist folder, would that mess it up?

plush stream
#

I'm not sure

inland notch
#

would having a period in a file name do it?

plush stream
#

Have you tried to recursive? Like File = open (r'C:\User\Somefiles')

inland notch
#

I'll try

#

nope

#

not that

trim ibex
#

try opening a more simple named file to narrow it down. i see you have a ' in it, maybe that i dunno

plush stream
#

Can you send the line of code that supposed to open a file?

inland notch
#

I have several

plush stream
#

Jeez that's long

inland notch
#

yes

#

is anything off?

#

@plush stream could it be windows defender?

plush stream
#

I couldn't find the dadgum line that open the file

#

You should really consider adding comments on your codes, jayzus i couldn't find which is which

#

Also, i doubt that errno 22 caused by defender

#

If it is blocked by win defender, it should have a different error message

inland notch
#

I'm using pycharm, if that helps

plush stream
#

Could you tell me on which line is the code that have the Problem? Im having a hard time finding it

inland notch
#

It's not the code, it's when I try to compile the program

plush stream
#

Okay well, what configuration did you use in pyinstaller? e.g = pyinstaller -noconsole myscript.py

inland notch
#

Yeah

trim ibex
#

the program runs fine but doesn't work when you freeze it using pyinstaller?

inland notch
#

It worked before, I've compiled it fine before but Idk why it's not working now

trim ibex
#

hard to say but maybe all your assets aren't being included

plush stream
#

Did you leave any folder that contains maybe textures?

inland notch
#

Yeah

trim ibex
#

oh it says Icon.ico not found

inland notch
#

that was before, I made a typo

plush stream
#

If you have separate texture folder then pyinstaller not gonna include it so you have to copy it manually

#

Or generally any separate folder

inland notch
#

Yeah I know

#

I take the exe and the assets folder and put them in their own folder, zip em, the put it on gamejolt

trim ibex
#

for what i did it helped when i put a init.py in my icons folder. pyinstaller could find them then

#

discord ate the underscores but you know the filename

#

a blank file, just indicates that it should be looked at

#

oh and i did import icons

inland notch
#

No I don't

plush stream
#

I've never use the import icon function in pyinstaller, so after it compiled i'd just have to slap the icon with resource hacker

trim ibex
#

__init__.py

#

ok that worked

#

lemmie see what else i have in code, i dunno if it'll help you or not

#

at the top:

# All that python imports here is an empty init file.
try:    import icons
except: pass

later to load the icon

try:
    # the frozen version will still try to load it manually first
    ctrl.setIcon(imageFilename)
except:
    folder, file = os.path.split(imageFilename)
    ctrl.setIcon(BytesIO(pkgutil.get_data(folder, file)))

in the .bat file in pyinstaller's flags

--add-binary "icons\clock32.png;icons" ^
inland notch
#

h u h?

#

Oop

#

I got it

#

nvm

trim ibex
#

oh nice

inland notch
#

It was windows defender

plush stream
#

Ah, thank God

trim ibex
#

rubycon, doing it this way you can change the program's icon without hacking resources

plush stream
#

Haha, thanks, it's already a habit, but i might try that one in my next project

inland notch
#

I feel so smart

trim ibex
#

i dont think you need all those 'global' do you? if they're already defined outside a function

inland notch
#

Yeah you need "global" to change variables inside a function

#

I think

trim ibex
#

not if they're defined outside the function

#

so like when you started it and only had "score" inside functions it probably didn't work but now it would

#

i dunno, try it

inland notch
#

Try what?

trim ibex
#

removing some

#

oh actually i guess if you do a "score=0" in the function it'd make a local version

#

what i usually do for something like that is make a dict, like cfg = dict(score=0, something=1)

#

some of this stuff you could trim down though, i think this might work for your audiorefresh function ```python
def audiorefresh():
map(lambda x:x.set_volume(volumeslider.get()), [Jumpsfx, Pewsfx, Hitsfx, Pickupsfx, Megalazersfx, Jumpsfx, Walksfx, EnemyLandsfx, Newwavesfx ])
Game.after(1, audiorefresh)

#

you could use a regular loop if you think it's not so readable like that

fluid tinsel
#

How can I fix error:
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
I’m using PyQt5 and I keep finding c++ fixes, but I’m using PyQt.
My code is: https://paste.pythondiscord.com/okekivamib.py
My main file’s code (the above one’s to make stuff easier) is just:
import selflibC as c, which shouldn’t do anything, but regardless, I get that error.

digital rose
#

e

proven basinBOT
#

:incoming_envelope: :ok_hand: applied mute to @digital rose until 2020-09-11 09:47 (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).

lyric nebula
#

hey guys how to change window background colour in tkinter

static cove
#

@lyric nebula Do you mean of a frame or of the root window?

lyric nebula
#

root

static cove
#

You should be able to do root.configure(bg="blue") or whatever color you'd like.

lyric nebula
#

ok thanks

static cove
#

You can also use hex values, I find that's nicer than the primary colors tkinter provides

lyric nebula
#

hex values?

#

u mean rgb

static cove
#

Like #856ff8

lyric nebula
#

oh like hexagon

#

type of data like binary

static cove
#

Not quite. It's just a different way to break down rgb (iirc) that's a bit more used in the design space

lyric nebula
#

ok

lyric nebula
#

how can i create a desktop notifier

#

and a youtube video downloader

rough isle
#

We won't provide help with things such as a Youtube Video Downloader, that would be against the rules.

#

!rule 5

proven basinBOT
#

5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious/inappropriate or be for graded coursework/exams.

lyric nebula
#

is that rule breaking?

#

sorry i didnt know

#

what about desktop notifier

rough isle
#

There might be a module that allows you to create custom Windows notifications, otherwise, you could create one yourself using a borderless windows.

trim ibex
#

a youtube downloader doesn't break any laws or terms of service

#

you're allowed to download youtube videos if you get express permission from youtube or the content owner

#

dont try and do legal work for them

#

programs like that dont break laws, PEOPLE DO

#

you're fighting for opressive copyright laws if you slap down every piece of software, it isn't python discord's job to be the police

#

not to mention people are here for learning; if they just wanted to steal content they could use the thousands of tools out there to do it

static cove
#

But people in this server do have to abide by the rules of this server, which includes not breaking other site's TOS. A youtube downloader (without the express permission youtube, which good luck obtaining) is against youtube's ToS.

#

Therefore, we don't help with that here.

trim ibex
#

creating a video downloader doesn't break tos

#

so no, you're wrong

static cove
#

!ytdl

proven basinBOT
#

Per PyDis' Rule 5, we are unable to assist with questions related to youtube-dl, commonly used by Discord bots to stream audio, as its use violates YouTube's Terms of Service.

For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2019-07-22:

The following restrictions apply to your use of the Service. You are not allowed to:  

1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service;  (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;  

3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;  

9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
trim ibex
#

where's the clause where it says people aren't allowed to create python programs

static cove
#

using any automated means a python program would fall under automated

trim ibex
#

so you're ignoring the exceptions

#

and you jsut want to declare all video downloaders illegal cause you're gonna be a good copyright cop

static cove
#

... no? I'm saying that on this server we can't help with anything that would break youtube's ToS. Which downloading youtube videos does.

#

Violating ToS != illegal

trim ibex
#

you're talking in circles

#

it does not break tos

#

the user may or may not break the tos, depending on how he uses it

#

it's like saying ban all skateboards because they're illegal to ride in the street

#

what? you make skateboards? go to jail!

#

people like you who blindly rules-lawyer everything are the reason everything is such a mess

graceful shoal
#

Hi, we have it pretty explicitly in our rules that we won't help with any ToS-breaking code.
If you want to use YouTube in a programmatic way, you can use their API and we'll be glad to assist you with it, otherwise that's not something that we'll provide help with.

trim ibex
#

code doesn't break tos, that's my point

#

people do

graceful shoal
#

That's a meaningless statement. You'll breaking that ToS by running that code

trim ibex
#

he's allowed to legally and ethically and without breaking tos to create a video downloader, or to ask for help on one

#

look if you dont want it on the server fine, but there's zero wrong with it

graceful shoal
#

I beg to differ, but either way I am telling you that we don't want it on the server.

trim ibex
#

i beg to differ

#

there isn't anything wrong with it

#

how about taking out your phone and recording it?

graceful shoal
#

Let's cut to the chase - please don't ask about automated means to use YT if it doesn't use their API.

#

I won't continue this argument

trim ibex
#

ok, then dont say 'i beg to differ' about there not being anything wrong with it

#

if you dont want to continue dont add in the tanget that i objected to that isn't relevant to what you do here

graceful shoal
#

Are you done?

trim ibex
#

this is what i said: look if you dont want it on the server fine, but there's zero wrong with it

#

and you continued, so yeah i'm just makign sure we're clear that you dragged it out

#

so yeah now i'm done

#

are you?

graceful shoal
#

Sure, now let's move on

trim ibex
#

ok, let's move on now.

#

now that i have the last word, unless you're petty.

static cove
#

@lyric nebula are you looking for something like the windows "toast" notifications?

#

Someone in this channel like... maybe 3 months ago? made a pretty neat application with windows toast notifications

#

I wonder if I can find it again

trim ibex
#

do you remember something specific said? might be able to search and find the old conversation

frigid nacelle
#

hey, so this is super trivial but im trying to get AppJar to have a right click open a menu, and i think ive got everything figured out except giving a button a seperate function to a left click. How do I bind a function to the rightclick specifically (app.bindKey("<Button-2... returns Button-2 is already bound. Thanks in advance and pls ping me i gtg go eat now 🙂

trim ibex
#

i haven't used appjar but it looks like it's a wrapper around tkinter. took me a while to figure out that in tkinter when you do a .bind() you can add a parameter add="+" to add another binding. maybe appjar has something similar

#

looks like you can use tkinter's bind directly with appjar

earnest oar
#

any1 know any colored terminal text packages that work on all versions of windows so like7,8,10 and mac besides colorama

frigid nacelle
#

@trim ibex ah, that would make sense, thanks 😄

#

yep that made it work

trim ibex
#

how is appjar, looks neat

#

i like the design philosophy of making things simple on the surface and powerful under the hood

frigid nacelle
#

its not as manipulative as tkinter in terms of precision, but in terms of easy to use i'd compare it to html tbh, its pretty much 'make a button, put it here, make it do this', so still kinda complex but much nicer than tkinter, especially for grids

#

could do with some nicer documentation imo, but then again its made for pretty GUIs and i dont use it for pretty GUIs XD

frozen schooner
#

how can I make a lineEdit in pyqt5 trigger an action without pressing a button

trim ibex
#

what do you want to trigger it? hovering over with the mouse, typing with a key?

frozen schooner
#

@trim ibex like paste a link and it shows me information about it

trim ibex
#

so when you paste a link to the lineedit you want it to trigger an event?

frozen schooner
#

yes

trim ibex
#

hmm maybe there's an event handler thing for when the content changes

frozen schooner
#

there probably is

trim ibex
#

try mylineedit.textChanged.connect(somefunction)

frozen schooner
#

ok

#

it works thanks @trim ibex

trim ibex
#

np, looks like there's a textEdited too, which doesn't fire from programmatic changes like using setText()

frozen schooner
#

oh ok

#

i'll put that in mind

#

if i need it

trim ibex
#

seems like a useful widget, i never used it. i might use that for an input-style calculator

frozen schooner
#

yea

ruby pawn
#

Hey I'm trying to catch an event in PySide2 when you click away from an open QComboBox popup and it closes. I've tried .closePopup(), but no luck.

eager beacon
#

The focus Out event is what you want

frozen schooner
#

i want to trigger an action when a specific thing in the combobox is selected

#

pyqt5

eager beacon
#

IndexChanged

frozen schooner
#

how do i define the specific thing?

#

the item

#

i want each item to trigger a unique event

eager beacon
#

Box.indexChanged.connect(fn)

#

Add your logic in fn

#

It should take 1 arg

frozen schooner
#

yea but what do i do for the others?

#

other items

#

like something should change for python to know which item it is

eager beacon
#

Dispatch to different funcs

#

In fn

frozen schooner
#

so i do something like

#

if combobox = item1
then dothis

#

or what

eager beacon
#

Sec

#

I'll be home in a few and send you an example

frozen schooner
#

ok thanks

eager beacon
#

okay

#

box.indexChanged.connect(self.fn)

#
def fn(idx):
    if idx == 1:
        do_somethhing
frozen schooner
#

then if idx == 2:

eager beacon
#

you don't need to create other functions

frozen schooner
#

do another thing

eager beacon
#

just do it in the handle

#

unelss its a lot of work

frozen schooner
#

idx being self right?

eager beacon
#

or, you could use textChanged and in self.fn change idx to text and ask if text == "this"

#

no, it needs self and idx or text

#

the signal emits the text or current index of the box

frozen schooner
#

okay i'll test it

eager beacon
#

@ruby pawn you may want to set your box to have the focusPolicy of Qt.ClickFocus if you don't want the function to trigger if a user tabs to focus the box

#

rather tabs away

frozen schooner
#

oof

#

it crashs

eager beacon
#

let me see the code

frozen schooner
#

Process finished with exit code 1073741845

ruby pawn
#

I'll give it a shot Chris_

frozen schooner
#

its alot

eager beacon
#

just what you've changed since it wasnt crashing

frozen schooner
#

k

#
        self.comboBox.clear()
        self.comboBox.addItem("both mp4 256x144")
        self.ComboBox.indexChanged.connect(self.quality144)
        video_link = self.lineEdit.text()
        try:
            v = pafy.new(video_link)
            print(v.title)
            print(v.duration)
            print(v.thumb)
            st = v.allstreams
            print(st)
            for s in st :
                filesize = humanize.naturalsize(s.get_filesize())
                data = "{} {} {} {}".format(s.mediatype, s.extension, s.quality, filesize)
                self.comboBox.addItem(data)
        except Exception:
            pass

    def quality144(idx):
        if idx == 1:
            QMessageBox.information(idx, "144", "Tas sadloading")```
#

top bit and bottom bit

eager beacon
#

try str(idx) in the information method

#

title must be a string

frozen schooner
#

ok

ruby pawn
#

What argument does focusOutEvent() take?

eager beacon
#

just call it event

frozen schooner
#

crashed

ruby pawn
frozen schooner
#

Expected type 'QWidget', got 'str' instead

eager beacon
#

@ruby pawn focusOutEvent(self,event) should work

ruby pawn
#

I'm very new to this, is event an event object?

eager beacon
#

information(None,title,"144","Tas...")

#

its looking for a parent

frozen schooner
#

Unresolved reference 'title'

eager beacon
#

its a QFocusEvent

frozen schooner
#

idk how you are managing to help two people at the same time lol

eager beacon
#

well, your title was str(idx), so use that

ruby pawn
eager beacon
#

get rid of =None

ruby pawn
#

It triggers when I click it

#

Not when the window closes

#

How can I fix that?

frozen schooner
#

Expected type 'QWidget', got 'None' instead

#

help kiwi i'll go eat

ruby pawn
#

🙏

frozen schooner
#

👍

eager beacon
#
class ComboBox(QComboBox):
    def __init__(self,parent=None):
        super(ComboBox, self).__init__(parent)

    def focusOutEvent(self, e: QtGui.QFocusEvent) -> None:
        # you don't need to emit anything here 
        return super(ComboBox, self).focusOutEvent(e)
#

does this work?

#

you shouldn't be triggering a focusOut unless you've lost focus somehow

#

what does showPopup actually do when it emits?

ruby pawn
#

I can't .connect to the function now

#

I have no idea, I was trying to follow some dude on stack overflow

#

I think it loses focus on the QComboBox because focus goes to the QComboBox QAbstractItemView

#

But I want it to activate when the QComboBox QAbstractItemView window closes

#

But the closePopup or hidePopup has not been working for me

eager beacon
#

hang on let me try this

eager beacon
#

sorry, I was afk for a few minutes but I have no idea whats grabbing the focus away

ruby pawn
#

Alright, guess it'll forever stay a mystery then

eager beacon
#

even when you set specific focus policies it messes up

ruby pawn
#

Thank you for trying man

eager beacon
#

Nah, I've gotta go play with my kid but I'm officially curious now

#

I'll send you a message if I figure it out

ruby pawn
#

If you ever figure it out, @ me

#

👍

#

Thanks for taking a look

sudden coral
#

If you have child widgets, a child widget may have the focus and be consuming the focus out event.

#

Make sure only the "main" widget you want has a focus policy, and the children have no focus policy

plush stream
#

How do i create a new window inside QMainWindow?

#

pyqt5 of course

sudden coral
#

Instantiate the window object (QWidget or some subclass of it) and then use the my_window_instance.show() function

plush stream
#

Uh wot? Sorry i'm still new in pyqt, i 've just started learning 2 days ago, could you tell me how to do that?

#

I could send my code if that'll help

sudden coral
plush stream
#

Oh golly, it works! Thanks!

#

But i can't seems to "connect" the main window class with the second window class

sudden coral
#

In what sense?

plush stream
#

You see i use my second window to modify the variables inside the main window

sudden coral
#

Inverse the relationship

#

Store the new value in the second window, and have the main window read that value

#

This makes more sense because the main window is the once that has a reference to its child already, so it's much simpler

plush stream
#

Ahh, okay i'll try that, thanks!

sudden coral
#

If it's something time sensitive, then you will want to use Qt's event system

plush stream
#

Thank you

plush stream
#

Ah dang, it's still didn't work

#

I couldn't access the variable

#
from PyQt5.QtWinExtras import QtWin
from PyQt5.QtWidgets import QMainWindow, QApplication, QWidget
import sys

# secondary window class
class Secondary_Window(QWidget):
    def __init__(self):
        super(Secondary_Window, self).__init__()
        self.initSecondUI()

    def initSecondUI(self):
        self.dial = QtWidgets.QDial(self) # this is the dial i want to access in the main window


# main window class
class Main_window(QMainWindow):
    def __init__(self):
        super(Main_window, self).__init__()
        self.setGeometry(250, 100, 500, 500)
        self.initUI()

    def initUI(self):
        self.btn = QtWidgets.QPushButton(self)
        self.btn.setText("Open New Window")
        self.btn.clicked.connect(self.open_new_window)
        self.lbl = QtWidgets.QLabel(self)
        self.lbl.setText(str(self.dial.value())) # i'm trying to access the dial value in secondary window

    def open_new_window(self):
        self.second_win = Secondary_Window()
        self.second_win.show()


def window():
    app = QApplication(sys.argv)
    win = Main_window()
    win.show()
    sys.exit(app.exec_())

window()
#

I'm trying to get the value of the dial in secondary window to the main window

sudden coral
#

You can't set the text to the dial's value before its parent window even exists.

#

Keep in mind that the dial has a signal you can use

plush stream
#

Okay, so i have to set the parent window to main_window?

sudden coral
#

No.

#

Let me rephrase that in a more generic way

#

You cannot access the attribute of an object that has not yet been created.

#

First, dial is an attribute of self.second_win, not of self. Second, self.second_win is only created once open_new_window is called. Hence the problem you have.

plush stream
#

Aah, balls, so i have to create an attribute of dial in main window class then?

sudden coral
#

That is one way to solve it, but not very good since you're cluttering your main class with widgets that don't actually belong to it.

#

With some more info now, I see that using the dial's valueChanged signal is the best approach

#

Well, not necessarily the best, but it's good. There's another approach that's good but it depends on what you want

#

Example ```py
def open_new_window(self):
self.second_win = Secondary_Window()
self.second_win.dial.valueChanged.connect(self.set_label_value)
self.second_win.show()

def set_label_value(self, value):
self.lbl.setText(str(value))

#

Alternatively, you can move the following lines to __init__ instead, which will have the effect of preserving the second windows state rather than creating a new one every time

def __init__(self):
    # other stuff ...
    self.second_win = Secondary_Window()
    self.second_win.dial.valueChanged.connect(self.set_label_value)
plush stream
#

Oh my goodness, it makes so much sense now, i legit confused out of my head like a dumbass for full 5 minutes

#

That has helped me a lot

plush stream
#

Thanks once again Mark! It's working :D

sudden coral
#

You're welcome

placid nebula
#

could You guys recommend some kind of courses (free), books anything worthy about pyqt5 except official documentation that i could learn about each object and options?

plush stream
orchid yoke
#

Is tkinter a great starting point if I want to develop some very basic applications with good gui?

plush stream
#

If you're new to gui programming, yes imo, i started with tkinter for about 6 month and then soowly switching to more complex ui e.g: pyqt

plucky wedge
#

tkinter is easy but its not made to look nice , it will look like old programs

plush stream
#

Unless if you use the themed tkinter/ttk

placid nebula
#

well i want to make it look modern... tkinter has old gui styling... and has limited objects.
the link that You paste above is kinda chaotic... its about qt but truly someone who wants to use qt wont get much from that.
codemy's channel has tutorial about tkinter and its great because he shows each object and possibilities that can be used for.
i would really like to find something similar about pyqt5, but what i found is low quality..

plush stream
#

@placid nebula i know what you mean, i wish John Elder from codemy made a pyqt series, but this one is i think the best that i could find :)

bronze basin
#

is good

#

teaches u about the main stuff

#

and u can research on your own and expland

plush stream
#

You still could search for the individual widgets from learnpyqt.com though

#

Yeah, like ThunderX said

placid nebula
#

well this site looks fine

#

thanks guys

bronze basin
#

np

placid nebula
#

wonder why its not positioning when you put pyqt5 in first page, its not even on 5 first pages

frigid nacelle
#

@orchid yoke it depends, if youre looking for control over each element individually then yes, but if you want to be a bit more lax and get something that looks nice but with a little less control use appjar

#

its basically tkinter but the frontend is nice

frozen schooner
#

if I have a QcomboBox that has three items in it how do I assign each item with an action

digital rose
#

Hi, I had a question. Would one recommend building an IOS app in python using a library like Kivy(mb), i am unsure whether i want to go into that without knowing whether i’d get decent results. My goal is to make visual pleasing interfaces, you may Ping me.

frosty mango
#

hi, i needed a help with the formation of a program, i got this idea, well due to exams/test where a program takes(one paste all the questions from google docs) and it automatically finds and gives us answers (links related to the questions), is it possible?

frozen schooner
#

@frosty mango check beautifulsoup4 out

#

this might be it

ruby pawn
#

Any great arguments for PyQt over PySide2?

static cove
#

They're mostly the same. The big difference is licensing.

summer epoch
#

Hello there guys, Is it a bad practice in Tkinter to not to assign widgets to variables, if not needed? GWmustaKotoThONK

#

Pls ping me if anybody have some suggestion GWjiangLoveHeart

plucky wedge
#

depends , sometimes it doesnt change to much but when u need to for example .config soemthing it will be much easier with variable or maybe impossible without var

#

so i suggest using it anyways

summer epoch
#

Thanks, without assigning them I often feel messy, anyways Im gonna use it GWjiangPepeThumb

frozen schooner
#

how do I connect each item in a QcomboBox to an action in pyqt5

indigo needle
#

can someone recommend a good framework/module for creating a page where one can select between two gamemodes

#

as i need it for the startup page for my game

#

i prefer a much easier to learn framework compared to a heavy one

ruby pawn
#

@static cove What are the licensing differences?

frosty mango
#

@frosty mango check beautifulsoup4 out
@frozen schooner how can i enable it to take multiple values , that is multiple questions and provide link for each one

frozen schooner
#

one min i'll have to try it out

frosty mango
#

i got the way to take values from user, but only one liners are possible, one question in other words

#

posible for the program to suspect full stop as the end of one query

#

?

frozen schooner
#
    from googlesearch import search 
except ImportError: 
    print("No module named 'google' found") 

# to search 
query1 = "Geeksforgeeks"
query2 = "youtube"
for j in search(query1, tld="co.in", num=10, stop=10, pause=2):
    print(j) 
for j in search(query2, tld="co.in", num=10, stop=10, pause=2):
    print(j)```
#

@frosty mango

#

add more query as the other search

#

you can let it print something that can separate the searches from each other like a line of underscores

#

there is a 2-3 second delay for me between each query

frosty mango
#

wait i will show u

frozen schooner
frosty mango
#

i am not able to separate the questions and find links for each one

frozen schooner
#

i made a script that fetches the question from google docs and searches for it

frosty mango
#

can you provide it?

frozen schooner
#

yea 100%

frosty mango
#

oh tanks

frozen schooner
#

should i dm

frosty mango
#

thanks*

#

sure

frozen schooner
#

you don't have dm enabled

#

i cant send

ionic moat
#

Okay so when the program is ran, GUI 1 (the main window) is opened
when everyone is done with that window, GUI 1 will open GUI 2 and destroy itself, making GUI 2 the only window open
that works perfectly fine until when it's time for GUI 2 to open GUI 3
When GUI 2 is done with everything, it should open GUI 3 and close itself, just like GUI 1
but it doesn't work, it just doesn't do anything
the code is the same

#

This is where GUI 1 opens GUI 2 and destroys itself

self.window = QtWidgets.QMainWindow()
self.ui = UiMw()
self.ui.setupUi(self.window)
self.window.show() # OPENS GUI 2
MainWindow.close() # CLOSES GUI 1```
#

this is where GUI 2 opens GUI 3 and tries to destroy itself

from JSuite_Bank import Ui_MainWindow as Ui_MainWindow2
self.window = QtWidgets.QMainWindow()
self.ui = Ui_MainWindow2()
self.ui.setupUi(self.window)
self.window.show()
MainWindow_2.close()```
#

The problem is that the code looks identical so I think it should work

#

but what happens instead is that GUI 1 opens GUI 2 and closes itself perfectly fine but GUI 2 doesn't close after opening GUI 3

#

the code is the same so I'm stuck

swift halo
#

What error does it show?

ionic moat
#

No error mb

#

it just doesn't do what the code says

#

the first time, it works, the second, it acts as if the code wasn't there

#

so it does nothing

#

GUI 3 opens and GUI 2 remains alive

eager beacon
#

have you tried overriding the close event to force accept the event?

#

if that doesn't work maybe you could try destroy instead of close

ionic moat
#

no I have not

#

@eager beacon destroy works!

indigo needle
#

can someone recommend a good framework/module for creating a page where one can select between two gamemodes
as i need it for the startup page for my game
i prefer a much easier to learn framework compared to a heavy one

eager beacon
drifting tartan
#

in kivy, how can I animate the thickness of a line inside a boxlayout which is inside another boxlayout?

orchid yoke
#

How do I make a fixed position for the buttons so it doesn't follow the large buttons?

#

When the text inside the buttons goes more than 4 characters it messes up the grid

indigo forge
#

What is your favorite choice for a GUI framework, wxPython, PyQt or Tkinter? I need to make a choice and a good advice from people who know more than me would be great

bronze basin
#

i personally use PyQt and as of now its my favourite choice for gui with python. It is also not hard that hard to learn and has a wide community so if you have any questions you can just research and get your answer

#

use kivy for simple programs or mobile apps if u want but PyQt is better for more powerful and heavy applications as it is designed to be more than just a gui toolkit and is able to build entire applications.

fluid tinsel
#

I’m using PyQt5, and I’m building a program as a practice so I can learn how it works. The program just has some buttons which pop up a message box, which shows an example of a Hello World program dependent on the button pressed.

After I run my file, the label goes to the left side, instead of the top, and my goal’s to get it to the top, in this structure:

LABEL
BUTTONS```
I tried using `setAlignment` on the layout, and the label, and both at the same time but it didn’t work.
Code: https://hasteb.in/oxabifet.py
short spire
#

Can I ask something guys?

sinful kraken
#

Ofc.

short spire
#

Someone know if Pyglet do support "minimize to systemtray" function? I'm writting an app that needs it, I tried Tkinter but I appearently don't now I'm trying Pyglet but I can't find anything on docs about it...

fiery pier
#

How to convert TKINTER with many IMAGES, to an --onefile EXECUTABLE

sinful kraken
#

/pyinstaller -w --onefile
Use pyinstaller @fiery pier

fiery pier
#

How to add images @sinful kraken

#

I have a directory that contains all my images

sinful kraken
#

Make sure the images are in the same directory as the script.

#

Oh?

#

hmm have you put the path to directory in the python script?

fiery pier
#

Means?

#

I have put relative paths

sinful kraken
#

Good. Still not working?

fiery pier
#

I didnt try, because I don't know how to add images

sinful kraken
#

Ohh. Just make sure the relative path is in the script. Put the .exe outside same place as your image directory and hit run.

fiery pier
#

Will it simply work if I convert my script to exe without typing anything except pyinstaller-w--onefile

#

Lemme try.

sinful kraken
#

Should do. When you're debugging leave out the "-w" so you can see the error code in cmd

fiery pier
#

Ok

#

@sinful kraken

sinful kraken
#

Yeah?

fiery pier
#

Error -failed to execute script main

sinful kraken
#

Did you do it without -w?

#

If so. run the .exe through cmd,

fiery pier
#

Actually the issue is, when I keep it in my working directory (where my script is) it runs perfectly. But if I move it , to say desktop, it does not work

sinful kraken
#

Yes

#

Cause it can't find the images

#

That's the problem you're having.

#

use a shortcut to your desktop. To where the script is. Like how Games launchers work. Oin your desktop is a shortcut,. Not the actaul .exe.

fiery pier
#

But, its my first time. Can you please tell mye how can make it work if I want to circulate it

#

What can be the process, to make my programm executable in other systems.

sinful kraken
#

Ohhh. 🤔 Well it should just work.
Bascially all they gotta do is keep that .exe in the same place as your images and click on it to run.

fiery pier
#

Can we create a installer?

#

Like how big programmes have.

sinful kraken
#

Hmm maybe I remember seeing something

#

lety me google quickly @fiery pier

fiery pier
#

Ty ty..

sinful kraken
#

There's several there

#

Find one that works for you ^^

fiery pier
#

Ty

sinful kraken
#

Np

frozen schooner
#

how to make each item in a QcomboBox do an action

eager beacon
#

why not use addItem ?

frozen schooner
#

that adds an item but doesn't make it do something

#

i want an item to do an action

eager beacon
#

addItem(const QString &text, const QVariant &userData = QVariant())

#

it can take a QVariant as the userdata

frozen schooner
#

so how can i make it lets say print something

eager beacon
#

create an action and pass to QVariant.fromValue

#

set your action triggered to do something

frozen schooner
#

can i have an example?

#

i have this to make an item

self.comboBox.addItem("item_name")
eager beacon
#

sorry went afk

#

did you try it?

#

Im looking at QComboBox addItem doc string and it doesnt list the QVarient that C++ hhas

#

so just pass the action in after the text

frozen schooner
#

like pass a func?

eager beacon
#

or better yet create the action with the text you want and set that as the text

#

addItem('text',action)

frozen schooner
#

but the action would need more lines

eager beacon
#

then when the currentIndex is changed connect to something

#

get the currentData(Qt.UserRole)

#

it should be the action

#

What do you mean

frozen schooner
#

self.comboBox.addItem("item_name", func)

#

or action

eager beacon
#

action

frozen schooner
#

like the action is wont fit there

#

its more than one line

#

self.comboBox.addItem("item_name", print("hello world"))

#

would that work?

eager beacon
#

so define it above and pass the variable name in?

frozen schooner
#

yea

eager beacon
#

well, the docstring* does say Any, so i dont see why a function wouldnt

frozen schooner
#

ok i'll try

#

it says unsolved reference

eager beacon
#

why don't you just pass the action?

frozen schooner
#

because the action needs alot of lines

#

like that would merge two files and downloads a file

eager beacon
#
action = QAction('My super long\
action .....\
.....')

additem(text,action)
#

I have no idea what you mean

frozen schooner
#

ok one min lemme try

#

it activates the action when the item is created not when it is selected @eager beacon

eager beacon
#

okay well then I've misunderstood what you want

#

It works fine for me

frozen schooner
#

i want item1 to print("this is item1")

#

and item2 to print("this is item2")

#

do you get me now?

eager beacon
#

yep

frozen schooner
#

i want the combobox to function like a combobox

eager beacon
#

yup

#

agian, works fine for me

#

I don't know why its not working on your end

frozen schooner
#

bruh

eager beacon
#
from PyQt5 import QtWidgets


class Combo(QtWidgets.QComboBox):
    def __init__(self, parent=None):
        super(Combo, self).__init__(parent)
        self.a = QAction('Action 1')
        self.b = QAction('Action 2')
        self.addItem(self.a.text(), self.a)
        self.a.triggered.connect(self.handle_a)
        self.addItem(self.b.text(), self.b)
        self.b.triggered.connect(self.handle_b)
        self.currentIndexChanged.connect(self.method)

    def handle_a(self):
        print('A Triggered')

    def handle_b(self):
        print('B Triggered')

    def method(self, i):
        self.currentData(Qt.UserRole).trigger()


if __name__ == '__main__':
    import sys
    app = QtWidgets.QApplication(sys.argv)
    w = Combo()
    w.show()
    sys.exit(app.exec())
frozen schooner
#

it just prints the words without me selecting them

#

oh now that makes sense

#

that's not what i had

eager beacon
#

I figured

frozen schooner
#

works thanks

orchid yoke
#

Can you move half of buttons so It can be where I want it to be?

#

this is tkinter

#

something like this

#

don't mind the weirdly shaped buttons but the position of it

tribal path
#

Probably with empty widgets to use as spacers or something, may depend on how theyre managed

eager beacon
#

I think you should take a look at your physical keyboard

#

and pay attention to the first column of keys

#

then do the same with the last column

digital rose
#

Anyone here familiar with tkinter and can help me with some basic stuff? Thanks

dense wind
#

I've written quite a few terminal based scripts for various tasks, but I'm looking to start incorporating a GUI.

At the moment, the only two languages I'm familiar with are Python and basic ECMAScript. However, since I plan to learn more, I'm looking for a gui framework that I can grow with and eventually scale to much larger projects (Like Django).

#

I think that makes sense... Any recommendations?

eager beacon
#

PyQt/Pyside, both are pretty much the same and have a lot of gotchas with a somewhat steep learning curve but they also have the largest number of tutorials and stackoverflow questions available out of all the options.

dense wind
#

Looks like what I'm looking for, and I think I found a good book on it too. Thanks Chris!

crude galleon
#

Hey everyone, not sure if I can ask here in this channel. So I've been looking on how bpytop developed, I'm trying to figure out what library it has been using to create the TUI, I thought it used curses but its not. Anyone have any ideas how it build? Seems like it build from scratch

sudden coral
#

Yes, it's from scratch

rugged ingot
#

im using tkinter for my project and connecting it to mysql database..but what is this error?

sly prairie
#

hdrrrrrrrrrrr

#

ok sorry

maiden dragon
#

is this the best place to ask about pyinstaller or would a help thread be better

radiant shard
hollow torrent
#

hi! is there a way to convert 1s1m1h into a datetime delta?

#

if not right place pls tell where 😄

plush stream
#

Could someone help me with the QtWin.enableBlurBehindWindow() function to achieve something like this?

inland notch
#

ooh that looks awesome

plush stream
#

Yeah that's what im trying to achieve with pyqt

orchid yoke
#

What is the difference between padx and pady to ipadx and ipady in tkinter?

amber roost
#

@orchid yoke ipad basically adds wiggle room in the widget that is being packed, which is notable if it's made up of smaller sub-widgets which then have some more room to expand; pad adds the space on the outside (so kindof like ipad on the widget's parent), having the sub-widgets clump together as usual but adding a margin on the outside (left is ipadx=4, right padx=4)

cursive parcel
#

Could someone help me with the QtWin.enableBlurBehindWindow() function to achieve something like this?
@plush stream i m trying the same for quite some time !!

plush stream
#

Did you figured it out?

cursive parcel
#

@plush stream u can make window transparent [by changing alpha ] and then apply blur maybe

#

it is the only thing we can do in pyqt and even there is no option to do this in tkinter'

plush stream
#

@plush stream u can make window transparent [by changing alpha ] and then apply blur maybe
@cursive parcel that's the problem, that last part is the biggest concern, how do i apply blur?

cursive parcel
#

btw there are two methods i found when trying to do the same in tkinter , and methods i found were to use gaussian blur method [check it out , i think its method in numpy module as i remember]

#

or u can try something like

setGraphicsEffect(QtWidgets.QGraphicsBlurEffect())

bronze basin
#

that wont work

cursive parcel
#

the thing u r trying to achieve is called "VIBRANCY"

bronze basin
#

the QgraphicsBlurrEffect is literally there for Qtwidgets

#

so u cant apply that to a mainwindow

cursive parcel
#

ya ik

#

thats what the main prob i m facing too

#

other method was gaussian blur method only i could find out

plush stream
#

I couldn't find anything related to Gaussian blur in pyqt

bronze basin
#

enableBlurBehindWindow()?

#

doesnt work

#

?

#

just try your window name.enableBlurBehindWindow()

#

and make u sure u set opacity as well

cursive parcel
#

@plush stream try this once what thunder x says , if it works then tell me too xD

plush stream
#

Already did that

#

Didn't work

#

Do i have to set the opacity with .setWindowOpacity() or something else?

bronze basin
#

yes

#

like that only

#

yeah enable blur behind window doesnt work

#

at all

cursive parcel
#

ok lemme try once again , this thing is just insane , i heard that python company was facing somekind of issues with microsoft standards for this vibrancy feature

bronze basin
#

@plush stream turns out the QtWin.enableBlurBehindWindow()

#

doesnt even exist

#

atleast from what i know

#

its there for C++

#

only i think

plush stream
#

It exists

#

I could call it

bronze basin
#

so its impossible as of now ggs

#

how??

#

show your imports really quick

plush stream
#

Ok

bronze basin
#

i cant call it

plush stream
#

from PyQT5.QWinExtras.QtWin

cursive parcel
#
from PyQt5.QtWidgets import * 
from PyQt5.QtGui import * 
from PyQt5.QtCore import * 
import sys 
#

lol imported all

#

hey what if we choose bg as white image which is blurred / translucent will it work??

bronze basin
#

yes that will work

#

but that wont dynamically change

#

to the users background

#

@plush stream that doesnt even exist for me

#

wheree

plush stream
#

Whoopsie

#

Sorry wrong onr

cursive parcel
#

hey checkout my VS CODE

plush stream
#

@bronze basin it's from PyQt5 import QtWinExtras

Then you can call it by

QtWinExtras.QtWin.enableBlurBehindWindow()

#

@cursive parcel how did you do that?

bronze basin
#

@plush stream type object 'QtWin' has no attribute 'enableBehindWindow'

#

nah

#

it doesnt work

cursive parcel
#

actually there is extensionn called "vibrancy" in VS Code , Hyper Terminal software which provides vibrancy

plush stream
#

@plush stream type object 'QtWin' has no attribute 'enableBehindWindow'
@bronze basin enableBlurBehindWindow

#

Not enableBehindWindow

cursive parcel
#

it says window has no feature likek qtwinextra , maybe bcuz root cant be blurred

plush stream
#

If I'm not wrong, the qtwinextras is an exclusive on windows since i think it depends on windows's dwm (desktop windoe manager)

bronze basin
#

@plush stream yeah it works now but it still doesnt get blurred

cursive parcel
#

ya

#

dang it

plush stream
#

That's what im facing rn Thunder

cursive parcel
#

guyz so anyways lets leave it for now what do u say

#

so anyways where do u live

bronze basin
#

i dont even think its supported anymore

#

so ggs

plush stream
#

dang :(

bronze basin
#

if u want to make your thing look blurred

#

just use a blurred background image

#

only alternative

cursive parcel
#

ya , but does it work?

bronze basin
#

just use a QLabel or smth??

plush stream
#

It won't dynamically change ain't it?

cursive parcel
#

i thought of this idea though havent tried

bronze basin
#

nah

cursive parcel
#

i think we should post this vibrancy thing on pyqt discird server

bronze basin
#

doesnt matter

#

ruby tried

cursive parcel
#

hmm

#

guyz can u help me create page for tk app

bronze basin
#

just use PyQt 😂

#

why tkinter

plush stream
#

Found this

#

Idk if it works tho

cursive parcel
#

i use pyqt alot

bronze basin
#

OK

cursive parcel
#

but there is a school projetc

bronze basin
#

whoops

#

school projects forces you to use tkinter?

#

thats a bruh moment

cursive parcel
#

thats a bruh moment
@bronze basin lol yes

bronze basin
#

yeah schools always be like that

#

forcing you to use bad tools when theres better tools available

#

not that tkinter is neccesarily bad

#

its just that pyqt is way way better

cursive parcel
#

now i m having trouble in making page change on clicking those sidebar tabs

#

its just that pyqt is better
@bronze basin yeah totally

bronze basin
#

i can help with pyqt

cursive parcel
#

making this ui [above] , i was thinking of making best ui ever made with tkinter

bronze basin
#

but i aint good with tkinter

cursive parcel
#

hey can u help me convert this to pyqt

#

i was thinking if i could convert this to pyqt , i could add alot of features

#

but i m still not that PRO with pyqt so would ya like to help me convert

bronze basin
#

did u even add any features? or logic?

#

like i mean have u only designed the ui or

#

done the logic as well

cursive parcel
#

lol i just made btn functions , but gonna add database , server and many function later on

plush stream
#

Oooh, pyqt is waaaaay better that tkinter

cursive parcel
#

but the main prob is i cant convert to pyqt thats where i need help

#

Oooh, pyqt is waaaaay better that tkinter
@plush stream yep

bronze basin
#

ok so u didnt add any logic?

cursive parcel
#

for now , NOPE

bronze basin
#

hmm i see

cursive parcel
#

there r just buttons and basic ui which works

plush stream
#

I just rewrote my app on pyqt

bronze basin
#

@plush stream hol up

#

i might have foudn a way

#

to get the blur effect]

plush stream
cursive parcel
#

cool

bronze basin
#

Look

#

@plush stream basically

cursive parcel
#

ruby con would u help rewrite too

bronze basin
#

if you use a Qframe for your main window

#

since its qwidget

#

you can set the opacity low

#

and then do the Graphicsblur effect

#

yeah this will probably work

#

if this doesnt work

#

you cant do it

cursive parcel
#

ya now it makes sense

#

it should , there's only way to find out!

bronze basin
#

ill try right now

cursive parcel
#

ya , if u succeed then post an emoji lol

#

the happy one

proven oxide
#

@cursive parcel @bronze basin cool ui designs

#

really wonderful uis with tkinter

cursive parcel
#

thnx

bronze basin
#

uh what

#

lmao didnt even show anything

cursive parcel
#

its server based

#

and in left side there is a canvas where we can draw

plush stream
#

lmao didnt even show anything
@bronze basin that's a bad sign isn't it, ohno

bronze basin
#

hmm i might show a project i did later

cursive parcel
#

hey anyone there!!

bronze basin
#

@plush stream F

#

its aint working

plush stream
#

Ah, crap

bronze basin
#

thought i pulled off a move and a half lmaoo

plush stream
#

Well atleast you tried haha

bronze basin
#

yes

cursive parcel
bronze basin
#

wdym?

#

create what exactly

#

the gap between the window?

cursive parcel
#

yes

#

this is same program

#

having window buttons in above frame and main program interface in below frame

bronze basin
#

i am not sure how exactly one would do that in pyqt

#

one sec

plush stream
#

I think pyqt has a scripting language that are very similar to css, it's called qss if i'm not wrong

#

But it definitely didn't have all the features that css had

bronze basin
#

yes

#

@cursive parcel make a qframe in that place where u want the empty gap

#

either set the stylesheet r,g,b,a=0
or use the QGraphicsOpacityEffect for the Qframe

plush stream
#

What about the rounded window?

#

Could you round a window in pyqt?

bronze basin
#

perhaps if u make a QFrame and use Qss for the borders and remove the window border generated by window

#

basically make your QFrame your mainwindow

#

like Main QFrame

plush stream
#

Okay

proven oxide
#

@cursive parcel sweet designs

#

i like flat ui desighn

#

design*

#

its simple and cool

cursive parcel
#

@proven oxide thnx man , i like to play alot with ui structures

#

perhaps if u make a QFrame and use Qss for the borders and remove the window border generated by window
@bronze basin

ya border rounding is super simple in qt

#

@cursive parcel make a qframe in that place where u want the empty gap
@bronze basin okey thnx

#

thnx to @plush stream too

west briar
#

can anyone tell me what is the best gui out there ik tkinter but thats not the best so can anyone telll me which one is the best according to u guys

#

@sand warren

sand warren
#

hey

west briar
#

hey

sand warren
#

well..

#

i can give you my oppinon on the matter

west briar
#

sure

#

go ahaead

sand warren
#

but im not a gui guy

west briar
#

ohk

sand warren
#

so.. when you want to make an interface you are left with some options

west briar
#

well what do ur friends use tho

#

ohk

sand warren
#

from great to excellent

#

so one is kivy

#

its a great gui framework

#

its user friendly

west briar
#

ohk

#

what about pyqt5!?

sand warren
#

easy to learn. but it takes a lot of time

bronze basin
#

its better

#

pyqt

sand warren
#

now qt5 is excellent

#

but

#

its hard to learn and takes a long time to learn

#

so its all about what you feel like doing

#

do you want to invest all the time to learn QT5

west briar
#

hmm ok well i dont need guis for large projects

sand warren
#

or start with something like kivy

west briar
#

so i'll consider learning kivy

#

yeah

#

ohk

sand warren
#

now, i do not use any of them

#

i have used qt and kivy before

west briar
#

woah! ok

sand warren
#

but i make my interfaces using web tech

west briar
#

wut?? i don't get it!?

sand warren
#

so. lets look at how discord does it

west briar
#

hmm ok

sand warren
#

it looks like an application for your desktop right

#

buts its actually made using web-tech

#

so it runs in a browser

west briar
#

ohh

#

so this app is kind of a browser

sand warren
#

are you on a desktop using discord now?

west briar
#

yeah

sand warren
#

press F12

west briar
#

nothing happens

sand warren
#

hmm.. well.. maybe its more you have to enable

west briar
#

prolly coz i have turned off the developer settiongs

#

yeah

sand warren
#

so it would open the dev tools like it does in chrome

west briar
#

yeah the inspect one ig

bronze basin
#

hes basically using js,css and html to create interfaces @west briar

#

like with react

#

or something

sand warren
#

I do not use react at all

#

i just use a web-server to show my UI

bronze basin
#

well

#

i am saying u can use react js

#

if u know js,css and html

sand warren
#

yes, i agree.

west briar
#

ohk interesting

sand warren
#

react would be part of using web-tech

#

react. vue.

#

ermm... something more maybe

#

there are many ways

#

now, i would recommend you to look into kivy as well

#

its a great library for gui development

west briar
#

well wait do i need to learn js,html,css for web-tech??

#

now, i would recommend you to look into kivy as well
@sand warren i'll definetly learn ti

#

it*

sand warren
#

yes. the web is made out of js, html and css

obtuse thistle
sand warren
#

but there are many many other ways of making an interface for the user

west briar
#

hmm yeah

sand warren
#

this is just my two cents on the matter

west briar
#

well prnslly why i loved qt was coz of the designer like it makes the guis so more interactive and easy to use

sand warren
#

qt is excellent. its just hard

#

nothing negative about it.

west briar
#

yeah prolly save it for future

#

yeah

#

anyways thnx for the help everyone here

sand warren
#

learning qt will always be useful.

#

i would say the same about kivy 😄

west briar
#

ohk 😅

sand warren
#

ill have to walk my dog now.

west briar
#

ohk go ahead

sand warren
#

just find me later if you want to talk more

west briar
#

i need to sleep now

#

sure

#

prolly like 8hrs later lol

sand warren
#

have a nice one 😄 nice talking to you again 😄

west briar
#

same to you man

#

bye

cursive parcel
#

can anyone tell me what is the best gui out there ik tkinter but thats not the best so can anyone telll me which one is the best according to u guys
@west briar

depends on what u wanna make , but u can use pyqt

west briar
#

nah i'm talking about the daily uses

#

like making some small applications

#

i am fed up of using tkinter

#

so wanted to learn something new

cursive parcel
#

bro see , many people say tkinter is bad and lot of stuff , but i will disagree , tkinter is awesome and can make insane apps , though pyqt5 is best

#

w8

#

what u can expect

west briar
#

ohh

#

nice

#

well i'll see into it

#

but its really late here in india so gotta sleep now

#

ttyl in dms ig 😅

cursive parcel
#

also if u wanna learn new go for pyqt , else other are bad if u ask me , coz they take too much code and give less result

#

me too indian lol

west briar
#

ohh lmao

#

well i'll ttyl

#

if i need some help

cursive parcel
#

kk

bronze basin
#

aint even that late tho

plucky wedge
#

see this , this is TKINTER
@cursive parcel BRUH IS THIS SRSLY TKINTER?!

#

is it made with ttk or pure tkinter?

dense wind
#

I recently used a program that used the eel library.
https://github.com/samuelhwilliams/Eel

This program uses eel and the screenshots are very nice.
https://pypi.org/project/auto-py-to-exe/

It creates a offline web-based interface, designed using html/css and JS to interact with the backend. Since its css, you can use bootstrap and other themes. If you know some web dev it's basically a micro web dev framework. Haven't actually used it myself, but it looks like it'd be great for small programs.

frozen quest
#

I've used toga before and I like it

silk basin
#

Trying to implement Qlabel in PyQt5 but I am getting error:
cannot import name 'Qlabel' from 'PyQt5.QtWidgets'

#

Anyone know why?

#
from PyQt5 import QtGui
from PyQt5.QtWidgets import QWidget,QHBoxLayout
from ColorWidget import Color
#

this is my current import

sudden coral
#

the L must be capitalised

silk basin
#

ahh

#

yes

#

me dumb thank you

#

So if I am trying to add a label where the current color yellow is. Do I need to create a function for that?

indigo needle
#

Tkinter vs pyqt what do you guys recommend for light GUI for some projects regularly. Which one is easier to learn

sudden coral
#

Tkinter is easier to learn and pyqt is more powerful

#

I suggest you make the investment to learn pyqt, even if it has a steeper learning curve

#

@silk basin I think it'll get positioned there if you set the label's parent to the yellow colour widget. Of course, that means you need to assign that widget to a variable first rather than directly passing it to addWidget

#

The other way you could do this is add the label directly to the layout and then use a style sheet to change its background colour

#

Which is probably more idiomatic honestly

silk basin
#

@sudden coral I ended up figuring it out! Program is coming along 🙂

cursive parcel
#

is it made with ttk or pure tkinter?
@plucky wedge TRUE af , it is pure tkinter , it is not about language u use in making UI , it is about simple geometry and colors

#

I recently used a program that used the eel library.
https://github.com/samuelhwilliams/Eel

This program uses eel and the screenshots are very nice.
https://pypi.org/project/auto-py-to-exe/

It creates a offline web-based interface, designed using html/css and JS to interact with the backend. Since its css, you can use bootstrap and other themes. If you know some web dev it's basically a micro web dev framework. Haven't actually used it myself, but it looks like it'd be great for small programs.
@dense wind

yes u can use html css js, eel, electron js to make cool web based apps

rugged ingot
#

anyone here knows about tkinter and can help me?

plush stream
#

What problem are you having with tkinter?

cursive parcel
#

@rugged ingot state ur prob bro!

#

everyone is here to help i guess lol

dapper kraken
#

Can someone teach me Tkinter

#

Like the basics of it

#

You can join the vc if u want to

#

Just the basics

last mantle
#

Does anybody know how to create a button where all you can see is the text and the background is transparent in Tkinter?

fiery pier
#

@last mantle Tkinter does not allow you to create a transparent button! You can try using a a transparet gif, and check if that works

last mantle
#

Ok thanks

nocturne kindle
static cove
#

@nocturne kindle tkinter, not tkinder

nocturne kindle
#

oh

fiery pier
#

Hellw

#

Anyone there there to help me with tkinter?

static cove
#

What are you having trouble with?

fiery pier
#

So, I have made a calculator, and it fits perfectly in my pc

#

But I gave it to my friend, but it does not work fine

#

His window was like this

#

note--- he was on win 7 and i am on win 10

#

@static cove

nocturne kindle
#

why is this so big?

fiery pier
#

It's full screen

#
windowWidth = root.winfo_screenwidth()  # Getting window width
    windowHeight = root.winfo_screenheight()  # Getting window height
    root.geometry(f"{windowWidth}x{windowHeight}")
    root.resizable(False,False)
    root.state("zoomed")
static cove
#

It's hard to tell from the picture, what's wrong/different between the two?

fiery pier
#

The window size vary

#

My resolution is 1980x1080 and his is comparitvely lower

#

an my program does not fit there

static cove
#

hmmmm... My guess is there might be an issue in win7 with tkinter then for detecting screensizes.

cursive parcel
#

mine is this
@fiery pier cool calc ui man , almost similar to windows calc

#

@fiery pier i think if the program has sizing problem find a good size which can fit on many systems

tribal path
#

Could be due to their scaling. That likely wouldnt be accounted for with just winfo

fiery pier
#

@cursive parcel ty ty

#

@tribal path maybe

cursive parcel
#

@fiery pier i meant set FIxed geometry dont make it changable

fiery pier
#

ok

#

what can be the most standard

last mantle
#

Hey, just a quick question, I'm using this code

from tkinter import *

from PIL import Image, ImageTk

root = Tk()
root.title("FNaF-Maker-Clone")
root.geometry("1280x720")
root.configure(background="black")


class Bg(Frame):
    def __init__(self, master, *pargs):
        Frame.__init__(self, master, *pargs)

        self.image = Image.open("images/test.jpg")
        self.img_copy = self.image.copy()

        self.background_image = ImageTk.PhotoImage(self.image)

        self.background = Label(self, image=self.background_image)
        self.background.pack(fill=BOTH, expand=YES)
        self.background.bind('<Configure>', self._resize_image)

    def _resize_image(self,event):

        new_width = event.width
        new_height = event.height

        self.image = self.img_copy.resize((new_width, new_height))

        self.background_image = ImageTk.PhotoImage(self.image)
        self.background.configure(image=self.background_image)


e = Bg(root)
e.pack(fill=BOTH, expand=YES)
menubutton = Button(bg="blue").pack()

root.mainloop()
```And I can't place a button, text, or any other GUI element on top of it. Does anybody know how to fix this?
amber roost
#

Button(bg="blue")
Specifying e as the parent of the button would help

last mantle
#

Oh thank you

#

How might I do that?

amber roost
#

pretty much every tkinter widget takes its parent as first argument

gleaming cradle
#

should i learn qt or kivy?

fair bluff
#

This is my code

    def __init__(self, num):
        super().__init__()
        self.sLayout = QVBoxLayout()
        self.label = QLabel("Another Window")
        self.sLayout.addWidget(self.label)
        for x in range(num):
            print(x)
            self.progressBar = QProgressBar()
            self.sLayout.addWidget(self.progressBar)
        self.setLayout(self.sLayout)
        print(num)```
#

How would i stop at 10 progressbars and put the rest to the right

sudden coral
#

Use a grid layout instead of a vbox

#

This will allow you to specify both row and column when you add widgets to the layout

#

And you can calculate the column number easily using modulus x % 10

fair bluff
#

ok i will try that thanks

orchid yoke
#

hey checkout my VS CODE
@cursive parcel how

cursive parcel
#

@cursive parcel how
@orchid yoke add VIBRANCY extension

orchid yoke
#

Oh i already have that

#

Is it the background of yours that make the cool color scheme @cursive parcel ?

cursive parcel
#

true @orchid yoke

before i had cyan-green texture for my windows UI

then after an year , i changed it to blurple theme

west briar
#

wait what is VIBRANCY?? @cursive parcel

cursive parcel
#

@west briar Vibrancy is u can say that

Blur-ness x translucency-ness