#user-interfaces

1 messages ยท Page 68 of 1

unique forge
#

Qt/PyQt is definetely the way to go

#

there is also Kivy

wet plank
#

Haha I'm learning tkinter atm as part of Basic Programming (first year on a bachelor)

unique forge
wet plank
#

Ye, I like Python. We havent been "allowed" to use a lot of python-specific stuff yet, so would be cool to see what you really can do with python ๐Ÿ˜„

#

I just made the worlds shittiest program though. Couldnt figure out how to clear components in time for the deadline, so I just removed the option to search for something twice

naive rampart
#

PyQt makes your life much easier...

gritty dagger
#

guys how can i get empty string LineEdit value in Qt?

ivory ember
gritty dagger
#

line I need to check if a line edit has got some word/character in it? How do I do that?

ivory ember
#

get its current text with <widget>.text() and do like:

if word in <widget>.text():
  #do something
gritty dagger
#

ok thx ๐Ÿ™‚

ivory ember
#

np

naive rampart
#

move up your surface.blit and pygame.display.update()

amber roost
#

I would create a class that subclasses tk.Frame and tracks all widgets it creates in internal lists, having methods like clear, setdata, getdata and addrow to make it usable. Basically creates a tkinter frame with a lot more to it.
Also, you only need one mainloop per application, toplevels have a parent, they run with that. If you want toplevels to take the spotlight, call .focus() to focus them and .grab_set() to reroute all events that may show up to them

worthy creek
#

Yeah I was wondering, I had used it 5 years ago & was surprised people were still using iti

full bolt
#

Hey, first of all sorry if this is the wrong chat room.
I was wondering what the best GUI framework for python is atm.
I'm in need of creating an application at work, and because management doesn't enjoy want just a command line application they want some GUI.

Is there an equivalent to something like Electron.js where you can add styling in the form of CSS?

Thanks

desert dome
#

can I have some feedback ?

#

btw this was make with pyQt5

digital rose
# full bolt Hey, first of all sorry if this is the wrong chat room. I was wondering what the...

@full bolt if you want "stylish" UIs then PyQt is a good option to start with. Not wrong to mention here that Python doesnot have a truly amazing GUI library that has CSS like features in it. Tkinter is easy and quite flexible, yet it has an old school GUI look to it. But you can always start with creating your own little library by modding functions of some already existing libraries.

ivory ember
digital rose
#

Hey guys, what library would you recommend for terminal based ui's?

#

I want to do something like this

cold jungle
desert dome
#

thx

digital rose
#

@digital rose what do you need terminal GUIs for? i cant think of any reason as to why you should opt for terminal based GUIs rather than the regular ones.

gritty glen
#

@digital rose If you're trying to avoid curses check out "rich" https://www.willmcgugan.com/blog/tech/post/building-rich-terminal-dashboards/

Will McGugan Tech

Rich has become a popular (20K stars on GH) way of beautifying CLIs, and I'm pleased to see a number of projects using it. Since Rich is mature and battle-tested now, I had considered winding-down development. Until, I saw this tweet: The Tweet Do you want to see something really cool you can do [โ€ฆ]

digital rose
abstract relic
#

anyone here up?

#

need a little help

rich kayak
#

I have a question, how can I change the value in pygame.math.Vector2?

modern marsh
distant dome
#
    def delete_input_box(self):
        self.label_file_name.destroy()
        self.lineup_name_entry.destroy()

    def input_box(self):
        self.lineup_name_entry = tk.Entry(self.canvas1, bg="black", font=('calibre',10,'normal'))
        self.label_file_name = tk.Label(self.canvas1, text="Enter")
        self.label_file_name.place(x=305,y=250)
        self.lineup_name_entry.place(x=300,y=210)
        self.bind('<Return>', self.delete_input_box)
        return self.lineup_name_entry.get```
#

anyone know why this doesn't destroy the entry and label? (tkinter)

frigid tundra
#

You need to destroy lineup_name_entry.master (I am guessing this is actually a root window) because if you do not then you end up with a big box on the screen that is not transparent.

distant dome
#

The function isn't running

#

when I press enter

abstract relic
digital rose
digital rose
#

Not really. I have done all of it from the docs only.

#

Just start by messing around with the sample programs

cyan plume
#

Hello, hope PySimpleGUI is the same thing as user interfaces. I'm getting this problem every time.

chrome prawn
#

DUDE I HAD THE SAME PROB FOR HOURS

cyan plume
#

damn

chrome prawn
#

go to cmd

#

and type

cyan plume
#

i installed pysimplegui already

#

I INSTALLED THEPIP

#

DUDE I HAVE THE PIP

chrome prawn
#

oop

cyan plume
chrome prawn
#

tas what i was missing and took my hours

cyan plume
#

really tho

chrome prawn
#

idkk

#

destart studio code?

cyan plume
#

wait a minute

#

nope

#

still smae

chrome prawn
#

idk

#

try asking in gen

#

@cyan plume

cyan plume
#

what's gen :D

chrome prawn
#

general

digital rose
#

Thank you!

distant dome
#
    def delete_input_box(self):
        print('test')
        self.user_lineup_name = self.lineup_name_entry.get()
        self.label_file_name.destroy()
        self.lineup_name_entry.destroy()
        self.get_click_pos(self.button_text)
        return self.user_lineup_name

    def input_box(self):
        self.lineup_name_entry = tk.Entry(self.canvas1, bg="black", font=('calibre',10,'normal'))
        #self.lineup_name_entry.iconbitmap("valorant.ico")
        #self.lineup_name_entry.title("Lineup Creation")
        self.label_file_name = tk.Label(self.canvas1, text="Enter")
        self.label_file_name.place(x=305,y=250)
        self.lineup_name_entry.place(x=300,y=210)
        self.bind('<Return>', self.delete_input_box)```
#

When I change the last line to self.bind('<Return>', self.delete_input_box()) it works, but runs automatically

#

but currently it doesnt run when enter is pressed

#

like doesn't print test either

lofty pond
lapis scarab
#

so i decided to do a little project in python as practice and for fun and i also decided to make it a gui application but i dont know anything about guis in python so how do i get started?

ivory ember
lapis scarab
ivory ember
#

i read the packt book

#

has literally everything

#

but yea, the docs should be good too

#

dm me if u need help

lapis scarab
#

aight thanks dude

ivory ember
#

np

autumn badge
#

Anyone have a good way to do something like tabs for pysimpleguiweb?

digital rose
digital rose
# lapis scarab so i decided to do a little project in python as practice and for fun and i also...

@lapis scarab
ive been onto tkinter for 5 years now. its far more flexible and powerful than most people who expect it to be. i have never used PyQt5 because i never felt the need to. I dont use any ide from the internet too, just made my custom ide in tkinter. The point is, tkinter is more user-friendly, and has even more customisable Widgets. if you want stylish UI in tkinter you can use Themed Tkinter widgets (TTK).

modern marsh
#

i would recommend pyqt than tkinter even if its a bit hard to learn compared to tkinter

digital rose
#

since when have you been using tkinter

#

@modern marsh

modern marsh
#

Been a year now

#

Switched to Qt

digital rose
#

no wonder. ive been on it for 5 years+

#

no wonder everyone underestimates tkinter

modern marsh
#

I highly doubt tkinter is capable of what Qt is capable og

#

*of

digital rose
#

this is what happens when you comment on something you dont know about.

modern marsh
#

sigh

rain quarry
#

How would I go about making a drag-and-drop block-based interface in Qt? Kinda like the Lego NXT software, but instead of being side by side, allow every block to have inputs/outputs where you can drag lines between them
Image of Lego NXT:

#

I've seen some examples of how to do drag-and-drop in Qt, the main thing i have trouble with is how I'll link blocks together with lines and how I can create a block instance when it's being dragged out of the sidebar

distant dome
sudden falcon
# rain quarry I've seen some examples of how to do drag-and-drop in Qt, the main thing i have ...

Join Free PyQt5 Course:
https://geekscoders.com/courses/pyqt5-tutorials/

My Affiliate Books:
Beginning PyQt: A Hands-on Approach to GUI Programming
https://amzn.to/3m8hsAZ

Create GUI Applications with PyQt5 & Qt5
https://amzn.to/3jahfLv

Python GUI Development with PyQt5
https://amzn.to/3kfVzPD

In this PyQt5 video i want to show you How To...

โ–ถ Play video
#

Maybe this video will help you

rain quarry
#

got any text-based sources? not a big fan of videos, especially when on data

#

also what I'm trying to figure out seems a lot more difficult than a 13 minute video can explain lol

ivory ember
#

take a gander

rain quarry
#

got a link?

#

I found QDrag but that seems more related to moving e.g. files to import their data

#

@ivory ember

ivory ember
#

no offense, but r u dumb

#

its in the vid

rain quarry
#

I mean I can't watch the video right now

ivory ember
#

excuse my lang

#

so the codeloop website, under pyqt5 tutorials

rain quarry
#

and I can't seem to find anchor points for drawing lines between the dropped blocks

ivory ember
#

im just helping with "text-based sources" my guy, i duno about drawing lines

rain quarry
#

Isn't that exactly what I asked for though?

The main thing i have trouble with us how I'll link blocks together with lines

#

It also doesn't answer my other question:

... and how I can create a block instance (i.e. don't remove the one i dragged from) when it's being dragged out of the sidebar

minor dove
#

Hi. I am very new here. I was wondering if I could get some help with my code and if so where should I post it?

rain quarry
minor dove
#

thank you!

ivory ember
#

if i knew how to do it, i would've told you

unique forge
#

nvm

#

you want to make a drag and drop interface

digital rose
#

https://paste.myst.rs/k388rq0p So I am trying to make a custom python window using pyqt5 but it says that the language is not supported or defined. P.S. I am using vs code as my IDE. And I am sure that I installed pyqt5

distant dome
#

I am currently placing tkinter image buttons on top of another image, but I want the button images to have transparent backgrounds (to show the image below rather than the white) is this possible?

#

actual image

digital rose
rain quarry
ionic remnant
#

Hi, I'm currently making a program using tkinter, and I can't figure out how to delete a button from inside a function. Can anyone help?

digital rose
ionic remnant
#

gimme a sec

digital rose
#

you might just want to copy paste it.

ionic remnant
#

too many characters

modern marsh
#

!paste @ionic remnant

proven basinBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

ionic remnant
#

oh ok

#

Basically, you press the "start game" button and it's supposed to delete that and replace it with the buttons for the game. Instead, it stays there and gives me an AttributeError

digital rose
#

what exactly are you trying to build?

ionic remnant
#

An incremental game

#

sorry it's so messy

digital rose
#

ok i think i get it. when you say self.destroy(game) you are calling the object to destroy the "game"button

ionic remnant
#

yes, exactly

digital rose
#

what youre doing wrong is that youre calling object.destroy(*arg) whereas .destroy() is a function designed to destroy tk widgets. just replace that line with game.destroy() wherein, destroy() doesnot take any arguements.

#

and wait

#

your class structure is quite messed up. youre calling class (object), whereas you must say class button(Button): wherein Button is a Tkinter object!

ionic remnant
#

oooh

digital rose
#

and to create the button, instead of calling game.button() , do this:
class button(Button): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def PACK(self): self.pack() .. .. .. .. .. .. ..

#

this creates a tkinter button, that takes in default button arguements as *args, **kwargs

ionic remnant
#

ok...

#

I think I get it

#

It's getting late here though, so I might just pick this back up tomorrow, if you don't mind

digital rose
#

alright

spare glen
#

so, i am making an application using pyqt5
i want to close the window when i click a button, so i wrote this for that:
self.login.clicked.connect(self.closewin)

and the close fuction is:

        self.close()```


and i am getting this error
```AttributeError: 'Ui_MainWindow' object has no attribute 'close'```


what should i do now?
digital rose
#

can you post the full code?

mossy ice
#

Which library is the easiest and more intuitive to work with? I've tried tkinter, which seems to require less code, but I'm having problems with making the layout responsive, even though it looks like it would work.

#

Also, is there a less introductory tkinter guide that is less verbose and more of a "this class is for this, these are the most common methods, which do this" guide, with good practices and tips?

rain quarry
mossy ice
#

I've looked at pyqt5, but it seems you have to do more work, so I'm a bit hesitant.

rain quarry
#

I've found Qt to be very similar to React in the sense that each component is standalone and has its own state

#

If you want something real simple, go PySimpleGUI

cold jungle
#

i took a time to learn well pyqt5 and I still don't know 100% pysimplegui is a good one for starting

mossy ice
#

Any good pyqt5 tutorial that goes straight to the point?

unique forge
#

because of Qt Designer

#

drag and drop your interface

#

and convert into code

unique forge
#
mossy ice
#

I'll take a look, thank you

cold jungle
spare glen
#

i am making a to-do list, is this looking good?

ivory ember
#

overall layout looks good

#

might want to change the "done" to complete, at least for the "Done Selected" btn

#

so it would make more sense to say "Complete Selected"

#

in short, looks great!, just polish it up a little

spare glen
#

oke thanks for the feedback!

#

lemme do these changes

ivory ember
#

good job man

spare glen
#

what about this? i added a reminder too which will remind you about your task

#

wait

#

this one

unique forge
spare glen
#

thanks

chrome sail
spare glen
#

thank you ๐Ÿ˜

#

i am making this for my science fair actually

chrome sail
distant dome
#

(TKINTER)
I have a list containing all the buttons that have been placed, is it possible to iterate through the list with a for loop and do i.config(command = i.destroy) to change the command to delete the button when clicked?
this is my current code:
py def delete_user_lineup(self): print(self.placed_lineups) for self.placed_lineup in self.placed_lineups: self.placed_lineup.configure(command=lambda:[self.placed_lineup.destroy]) self.placed_lineup.forget() self.placed_lineup.place()
The output of print(self.placed_lineups) is:
[<tkinter.Button object .!frame.!activemapgui.!button29>, <tkinter.Button object .!frame.!activemapgui.!button30>, <tkinter.Button object .!frame.!activemapgui.!button31>]
And here is where the original buttons are appended to the list:

def place_lineups(self, default_lineup):
       # Iterate through all lineups in the list and set the correct icon for each lineup
       self.placed_lineups = []
       for i in range(len(self.agent_lineups_list)):
           self.lineup_button = tk.Button(self, width='20', height='20')
           self.path_to_img = "icon_images\\" + default_lineup["ability_type"] + ".png"
           self.pil_icon_image = Image.open(self.path_to_img)
           self.pil_icon_image = self.pil_icon_image.resize((20, 20,), Image.LANCZOS)
           self.load_image = ImageTk.PhotoImage(self.pil_icon_image)
           self.lineup_button.image = self.load_image
           self.lineup_button.config(border="0", image=self.load_image, command=lambda: [play_video(default_lineup["lineup_file_loc"])])
           # Place lineup to the coordinates specified for the lineup in the config file
           self.placed_lineups.append(self.lineup_button)
           self.lineup_button.place(x=default_lineup["x_coordinate"], y=default_lineup["y_coordinate"])```
errant rapids
#

Hello everyone,
making UI form and got problem

#

got error when trying to open second PyQt window

TypeError: QWidget(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags()): argument 1 has unexpected type 'sip.wrappertype'```

```class Login(QtWidgets.QWidget):
    def __init__(self, parent=Client):
        super().__init__(parent)
        self.lg = Ui_Login_form()
        self.lg.setupUi(self)```
its inherited from 
```class Client(QtWidgets.QMainWindow):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)```
icy plume
#

Anyone has idea how to make my app nicer?

errant rapids
icy plume
#

oh with tkinter

errant rapids
#

looks cool

icy plume
#

i am thinking about changing buttons i have a lot of space on left side

unique forge
ionic moat
#

PyQt5 makes the best UIs imo

modern marsh
#

Yes

digital rose
tacit swan
#

here's the code

#

here's the error

formal harness
#

I think you need a relative path for your logo.pngatbe try './logo.png'

tacit swan
#

It is running if I exclude 5th and 6th lines

hot bramble
#

i didnt know you could do user-interfaces with python

digital rose
#

You will be want os library to fix

#

Second

spare glen
digital rose
#

Ah sorry I don't know in pyqt just tkinter sorry again

ionic moat
spare glen
# ionic moat `window.close()` or `window.hide()`
  File "d:\important stuff\JNNSMEE\gui2.py", line 369, in <module>
    ui.setupUi(MainWindow)
  File "d:\important stuff\JNNSMEE\gui2.py", line 344, in setupUi
    self.pushButton.clicked.connect(MainWindow.close())
TypeError: argument 1 has unexpected type 'bool'```
#

i got this error

ionic moat
#

you're not supposed to call functions in a connect function

#

self.pushButton.clicked.connect(self.close)

#

maybe try this

digital rose
# digital rose Second

This will help you @tacit swan

import os
path = 'logo.png'
Image_path = os.path.join(os.path.dirname(__file__), path)
spare glen
#

oke

#

it worked

#

thank you so much

tacit swan
#

The problem is when I execute program it is showing error in init .py file.

spare glen
#

Hey @ionic moat, i made a function in which i have to close the main window but when i used your solution it showed me this error

  File "d:\important stuff\JNNSMEE\gui2.py", line 241, in find_and_login
    MainWindow.hide
AttributeError: 'bool' object has no attribute 'hide'```
#

this is the function

ionic moat
#

I think you want self.hide and also, you have to call it there

#

you don't call functions inside a function call when you're passing it as an argument

#

but if you wanna run the function 1 time, you call it

spare glen
#

oke lemme see

#
  File "d:\important stuff\JNNSMEE\gui2.py", line 241, in find_and_login
    self.hide
AttributeError: 'login_ui' object has no attribute 'hide'```
#

nope

ionic moat
#

Where is the window object?

spare glen
#

there are two functions, setupUi and find_and_login

#

def find_and_login(self):
def setupUi(self, MainWindow):

ionic moat
#

what is MainWindow?

#

is that the window object?

spare glen
#

oh

#

QMainWindow

#

idk what is that

ionic moat
#

can you try using hide on it

spare glen
#
  File "d:\important stuff\JNNSMEE\gui2.py", line 240, in find_and_login
    QMainWindow.hide()
NameError: name 'QMainWindow' is not defined```
#

nope

ionic moat
#

Remove the Q

spare glen
ionic moat
#

Then we can't do it without the window object

#

self should be the window object though

spare glen
#

with self, it says that

  File "d:\important stuff\JNNSMEE\gui2.py", line 240, in find_and_login
    self.hide()
AttributeError: 'login_ui' object has no attribute 'hide'```
#

self is the class maybe

#

because the class name is login_ui

tribal path
#

need to trace may through... where are you calling that method?

spare glen
tribal path
#

find_and_login

proven basinBOT
#

Hey @spare glen!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

โ€ข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

โ€ข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

spare glen
#

here you can see

#

in line 48

tribal path
#

what does def find_and_login(self): and MainWindow.hide() do?

spare glen
#

def find_and_login(self): finds the name and password entered in the text input in the database and Mainwindow.hide() idk

#

i removed the MainWindow.hide() coz it does nothing

tribal path
spare glen
#

done

#

then?

tribal path
#

readd the MW.hide()

ruby pawn
#

Hey, I'm working in PySide2 and creating an application running inside Autodesk Maya. I'm having some trouble with getting windows to stay on top. My main window has the maya window as it's parent and stays on top of Maya fine. But any subsequent windows I open, won't stay on top unless they're QMainWidgets with maya as a parent. If I try to just keep them QWidget and give them a parent, they get drawn inside the main window I parent them to, instead of opening a new window. And even if I just give it a stay on top window flag hint, it just disregards it completely.

autumn badge
#

has anyone tried pyside6 or are people still using pyside2?

modern marsh
#

pyside 6 doesn't have the full feature set pyside 2 has yet, I guess

#

It's safer to use pyside2

autumn badge
#

eventually you think?

modern marsh
#

Yeah

autumn badge
#

im willing to wait. i use a few different gui modules now. just looking into my pip script and figure i should add pyside

modern marsh
#

So you have never used pyqt/pysid

#

?

autumn badge
#

oh i have, years ago

#

pyqt4 and original pyside

#

just went a different direction for a while trying out different UIs. remi, flexx, appjar, pysimplegui, wxpython, tkinter (again), flask etc

modern marsh
#

Ah alright

mighty breach
#

anybody here able to help me with tkinter stuff?

#

I have been stuck for soo long in this dumb issue and really need help as im runnign out of time

autumn badge
#

@modern marsh i take it you are a qt fan? I started moving away from qt because i had some apps i wanted to write for $$ but pyqt caused some issued. and pyside had a hard time working on my computer

modern marsh
#

i like using tkinter too but imo qt is far superior

#

which module do you think is the best

mighty breach
#

@modern marsh can you help me with something in tkinter??

modern marsh
#

if i know it, sure

mighty breach
#

ok so

#
#global variable
PHU_CODE_tk = ''

def Q1comboBoxValue(event):
    global PHU_CODE_tk
    PHU_CODE_tk = q1DropDown.get()
    print(PHU_CODE_tk)

q1DropDown.bind("<<ComboboxSelected>>", Q1comboBoxValue)
#

all i want is for that global variable to get the updated value of what i select on my combobox

#

but setting it in the function doesnt work

modern marsh
#

i have never worked with comboboxes in tkinter so idk how to solve this

mighty breach
#

ok no worries

modern marsh
#

are you sure that the event is being called by the bind()?

mighty breach
#

yes

#

because if i print out the PHU_CODE_tk inside the function i see it

#

and i see the updated value each time

#

the only thing is the global variable is just empty, its not getting teh value

#

and i think its because im calling it inside of bind() but I need to

#

My goal is to get the updated value of what I select into that global variable

modern marsh
#

ah

mighty breach
#

ive been stuck for soo long its so annoying

modern marsh
#

can you share the code so that i can test it quickly?

#

!paste

proven basinBOT
#

Pasting large amounts of code

If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

mighty breach
#

sure, its really long and messy but the only parts that affect this is at the bottom where I call the function

#

idk if it will even run because theres files you need

#

like photos and stuff

modern marsh
#

@mighty breach so i deleted some code and stuff and the global var is getting updated

mighty breach
#

like

#

constantly?

#

when you click different options

modern marsh
#

yes

mighty breach
#

omg

#

ok

#

which code

modern marsh
#

i deleted all labels and buttons

#

then made my own button to print the global var

#

and it works

mighty breach
#

can you show me?

#

like the code

modern marsh
#

ye

#

code or screenshot?

mighty breach
#

doesnt matter

autumn badge
modern marsh
modern marsh
modern marsh
#

alright, i gotta go now, if you need help i will be back later on

autumn badge
#

just like having options

modern marsh
#

ah alright, good luck :D

autumn badge
#

i made a few apps in pyqt and enjoyed the coding

#

but i dont like pyqt due to the license

#

thus why asking about pyside

#

i have been playing around with flexx, pyjs and the like to have pure python versions of webapps

modern marsh
#

yeah pyside doesnt have license issues afaik

autumn badge
#

yea, pyqt does, pyside doenst

#

but i have always had issues with pyside actually functioning on my computer

mighty breach
#

@modern marsh where did i initialize the globla

modern marsh
#

at the top

autumn badge
#

and if i made money, i would b happy to pay for a license, but $500/month is steep

mighty breach
#

i dont think it works

#

the same thing happens

autumn badge
#

going away from pyqt was for the same reason i went away form fusion360. I dont like the idea of being forced to open source my stuff. i usually do, but i dont want to have to

ionic moat
#

I'm pretty sure you're only supposed to pay for a license if you want to use a Qt app commercially and under your own license agreement and private/closed source

#

otherwise commercial use for Qt should be free as long as you follow their guidelines such as:
Publishing the source code (making it open source)
Giving it an LGPL v3 license
etc

#

but don't take my word for it I might not be right

autumn badge
#

qt is free

#

pyqt is not

#

they changed the license to a stricter license with pyqt

#

pyside kept it the same

#

i remember looking a short while ago

ionic moat
#

Pretty sure it still applies for PyQt

autumn badge
#

no

#

they changed it

ionic moat
#

when?

autumn badge
#

it is stupid too

#

that is why they can charge

#

pyside you can make money

#

pyqt you cant

ionic moat
#

Yeah when?

autumn badge
#

doesnt matter right now because i havent made a dime on my apps

#

i dont remember when

#

but i was looking at it about a year ago

#

i just dont like the forced open source

#

i am fine with sharing my apps, but not always my source code

#

what if i want to keep it to myself??

ionic moat
#

I remember it saying you must pay for a commercial license or make it open source & propitiatory under their list of conditions with their chosen license

autumn badge
#

yea

#

"must make is open source" is what gets me

#

i tend to open source most of my shit, but i like to have the option of not

#

thus why i moved away from fusion360. i have a design that coudl let me retire by 40

ionic moat
#

If you don't want to then I think you gotta cough some money

autumn badge
#

but i hate the idea of it on the cloud

ionic moat
#

Yeah I agree it's pretty strict

#

I don't like their terms but there's nothing I can do

#

ยฏ_(ใƒ„)_/ยฏ

autumn badge
#

appjar is pretty decent

#

simple but effective

ionic moat
#

I wonder what my second option would be after Qt ๐Ÿค”

#

Basically anything else that's dated and has a designer for it

autumn badge
#

you need a designer?

#

that is tough then

#

i also tend to run apps that are a bit more dynamic where the number of items on the gui can change, so i like to code my gui instead

solid crystal
#

I use tkinter, I find it quite useful! It does have a few things that might not be the best, however it gets the job done well.

autumn badge
#

yep

#

i went with appjar because it is a simplified tkinter

solid crystal
#

You can't really use while loops without breaking some part of it, so it does get annoying.

autumn badge
#

appjar has done well for me thought

barren elm
#

On my last app I settled on pyside. Took some time to learn but eventually got it to work. The problem is that there aren't very good guides for GUIs in python that aren't basic and require threading and such. Especially for PySide/PyQT.

autumn badge
#

i have an app that dynamically builds 90% of the app from a json file

solid crystal
#

Can you install appjar with pip? Never heard of it.

autumn badge
#

yep pip/pip3 install appjar

solid crystal
#

sure, thanks!

#

I had never hear of it before

autumn badge
#

none of that pack crap

solid crystal
#

it's still under development by the looks of it

autumn badge
#

yea but fully functional

solid crystal
#

Ok, thanks! Will try it out.

autumn badge
#

wrote two apps for it for work a two years ago and still going strong

#

lots of options in there

#

i have it pulling form network drives, combining pdfs, importing pdfs, exporting pdfs and xlsx docs

modern marsh
#

and you can easily switch between PyQt5 and PySide2 as most of the code is repetitive in both

#

as far as i have tried

autumn badge
#

yep

tacit swan
#

Please look into this error I'm getting in init.py file

autumn badge
#

your path to logo.png is wrong

digital rose
#

to fix that error keep the logo.png in the same folder as your code

#

or like loki said enter the correct file path

barren elm
# modern marsh Qt docs have everything you need even if its in C++

Oh trust me. I looked a ton at the docs. Still took time to figure out how to thread my program and transfer data from the thread to the main thread. Especially as someone that was doing it his first time with no past experience in other languages.

I made a stock alerting app for my dad (faster than TD Ameritrade's stuff. Pretty sad lol). Definitely a good learning experience but brutal. Threading info in the QT docs was a bit beyond me. Sometimes I just need something explained like I am five ๐Ÿ˜†

modern marsh
#

well, thats true lol

barren elm
#

for him yes

autumn badge
#

what did you use?

#

pyinstaller?

barren elm
#

pyinstaller to make the exe and Advanced Installer to make the actual installer

autumn badge
#

check out nuitka

#

i just did a test with an app tonight

#

pyinstaller, 12mb 8 seconds to load
nuitka, 600kb, 2 second load time

#

i am having issues with my pyinstaller exe files that i have hosted on a network drive lately. now that everyone is working from home and using VPNs, loading time can take up to 30 minutes. When at the office where the servers are physically located, 30 seconds is standard

#

i am now remote so it takes me about 10 minutes to load the exe. luckily, i can just load the py file and it loads super fast
but my IT dept wont let me have others install python on their computers

barren elm
#

Are you just making it all into a single exe?

autumn badge
#

i have done both.

#

onefile and not

#

onefile take a lot longer

barren elm
#

Yeah, onefile is very slow.

autumn badge
#

not really if it is on your computer

#

it is tolerable at least

#

but over the network, shoot me

#

i discovered nuitka today, so i am looking forward to monday

#

gonna have a few people test it after i recompile my apps

barren elm
#

I will have to play with nuitka. Luckily my app isn't huge as it is.

autumn badge
#

i was surprised by the load time

#

i want to get it on the network and test it out

#

if it loads under 1 minute, i will be happy

#

i host them on the network so i dont have to make an installer or have people update if i make a change

mighty breach
#

anybody wanna trey helping me agaiN?

#

with tkinter

autumn badge
#

if they all just create a shortcut from the network, all i have to do it swap the exe and it is updated

winged orchid
#

is this javascriptj

modern marsh
molten tinsel
frozen creek
#

Hi

#

I have a doubt with tkinter in python

#

if anyone knows tkniter and could help me pls dm and help me

digital rose
#

you can post your query here.

solar frigate
#

Hi guys! I was wondering if either of you could point me in the right direction as my current project isn't in my area of expertise.

I store my (anime)series' ratings on an online database (and have access to their API) and want to re-rate most of the series on it (my tastes have changed over the last few years)

I wanted to build an web/or any other interface to help me rate these at speed (using my keyboard only). I was initially thinking of doing this using pygame? Since that's the only GUI library that I have somewhat experience with.

But I was wondering if you guys knew of any other "easier" or elegant way I could get this interface setup quickly.

My main area of comfort in Python is data science, so this just feels quite daunting to me :S

digital rose
solar frigate
#

I don't know how to explain what kind of interface I want to make. I mean ideally. I want something which cycles through series (or skip) with left/right keys. And then press a number (for new rating) and then press enter. And then perform some sort of a 'mass-update' to the server.

And you're right it is a game-dev library ๐Ÿ˜…

#

I just realised, I didn't fully specify my problem earlier.

digital rose
#

ah i get you. Tkinter has a widget called listbox. Just a widget, with items, through which you can scroll. consider this idea (ill post example code if you want):

  1. you draw the widget onto the screen.
  2. you then add the names of all items you wish to rate.
  3. you then record events, for key press. ( for instance, when the selection is on a particular item, and then you press 1, it assigns 1 star to that item.)
  4. create a command that creates a table with items in one column and ratings in the second one.
#

the listbox

solar frigate
#

Okay! I think I can try giving that a go

digital rose
#

this is an example table:

solar frigate
#

Okay, I'm gonna get the boilerplate from the API setup and I'll give this a shot. Thanks

mighty breach
#

Anybody here that can help me with tkinter?

#

Iโ€™ve been stuck for so long and I really need to figure out this issue to continue

autumn badge
#

Just ask it.

#

Someone will come around to help but donโ€™t ask to ask

mighty breach
#

Ok sorry

#

I have a combobox and I basically just want to current selected value to be stored in a global variable, I am binding the selection to a function that sets the value to a global variable but itโ€™s not working

hexed lance
#

im not sure if this is the right channel but how do i put images on my tkinter window

mighty breach
#

X = tk.PhotoImage(file=โ€œโ€)
A = tk.Label(image=x)

hexed lance
#

thanks

modern marsh
#

You have pillow module too to do that

mighty breach
#

no you odnt need it

#

only for some files

errant rapids
#

Hello guys,
i have a trouble with PyQt5 and Python 3.7.9

thats the code of Login Class:

    def __init__(self, parent=None):
        super().__init__(parent)
        self.lg = Ui_Login_form()
        self.lg.setupUi(self)
        self.checkThread = CheckThread()

        self.lg.btn_login.clicked.connect(self.login)

    def login(self):
        login = self.lg.line_login.text()
        password = self.lg.line_password.text()
        # self.checkThread.thread_login(login, password)
        self.callMessenger()

    def callMessenger(self):
        login = Login()
        login.lg.setupUi(Login_form.hide())
        client = Client()
        client.show()```

and UI file 

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_Login_form(object):

def setupUi(self, Login_form):
    Login_form.setObjectName("Login_form")
    Login_form.resize(270, 205)
    Login_form.setMaximumSize(QtCore.QSize(270, 205))
    font = QtGui.QFont()
    font.setFamily("Calibri")
    font.setPointSize(12)
    Login_form.setFont(font)
    self.label = QtWidgets.QLabel(Login_form)
    self.label.setGeometry(QtCore.QRect(100, 10, 70, 40))
    font = QtGui.QFont()
    font.setFamily("Calibri")
    font.setPointSize(24)
    self.label.setFont(font)
and etc.
so i  want to call method that opens another UI and closes current with ```hide``` method
#

i mean i have 1 class with Login form, and with button i want to call another one Form and close current

#

without closing programm

hexed lance
#

whats the easiest way to create a hyperlink with tkinter

viral wedge
#

Does anyone here use Gtk?

#

The Glib.idle_add(callback, *args, **kwargs) function is supposed to call a callback function when Gtk is idle. From my testing, it seems like the callback is called once, but the documentation seems to hint that the callback is called multiple times. Do you have any idea?

#

(Please mention me when replying. I won't get a notification otherwise)

autumn badge
#

figure they show it better than i could

hexed lance
#

thx

lapis scarab
#

so i am creating an application in python and i want to use pyqt5 to make that app but i dont know anything about guis in python nor do i know anything about pyqt itself so how do i start building with it

autumn badge
#

Youtube pyqt5 and you will get a list longer than you care for @lapis scarab

lapis scarab
#

alright then thanks

pure dune
#

Yesterday I saw a post showing a module of python that makes dark theme GUIs, but I can't find the post and neither I can remeber the name of the module

#

I think it had something related to dracula in the name, does anyone know what it is?

autumn badge
normal frigate
#

Hey, so I'm quite new in Python Tkinter, and I'm currently making a 5-Question Geography Quiz. However; I can't seem to figure out what's going wrong in a certain bit of my code. So basically, the first question, if the user selects the correct answer, I want the program to output a Label saying "Correct", but then I also want a delay in between the Label showing and the window closing and moving onto the next question. When it's ran, I click submit on the first question after selecting the correct answer, and the button stays pressed down for the 2 seconds I set it for, but doesn't show the Label saying "Correct". Here is the code: https://paste.pythondiscord.com/teravoleme.apache

proven basinBOT
#

Hey @normal frigate!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

โ€ข If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

โ€ข If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

normal frigate
#

fook, the code is too long; how do I post it?

modern marsh
#

!paste

normal frigate
#

ty ๐Ÿ™‚

tranquil lichen
#

good evening. I wanted to build a graphical petri net editor, so i can specify my code as a petri net and automagically generate a C++ code template from it for embedded targets. There is a little bit more to it, but it's not important for this particular question.

I need to understand how i can create clickable and draggable graphs in python; I have looked at networkx, it's not really suitable since it's only for the graph part; Then there was qt. But is qt flexible enough to have something like clickable circles without a lot of work (e.g. mouse events, tracking circles and having to calculate distances and things like that.?

#

it looks something like this:

#

What would be a good starting point to do things like these? I have thought about managing the data in adjacency matrices (or even networkx!) and certain containers for the T_n things and present it using qt5, but the drawing part is what seems hard to me with these boxes, lots of arrows and lines and circles each clickable and dragable. I have never programmed a single GUI in my life, so literature recommendations are welcome too.

#

i don't wish to spend a terrible lot of time with GUIs though as I come from the domain of systems and control theory and would rather treat it as a tool for something else, but just enough so that it works.

tranquil lichen
rain quarry
#

decided to work on the back-end first, UI will come later

#

turns out doing real-time audio in C++ in a blocking fashion is awful

tranquil lichen
#

Would it be OK for you if i dm'd you to ask you more about it?

rain quarry
#

sure

hybrid spindle
#

So whenever I use tkinter, I get these annoying boxes that pop up over the duration of the program. Over the course of the program, they continuously build up until I'm left with an unruly amount littering the screen.

root = tk.Tk() badfits = simpledialog.askstring(title='Bad Fits?', prompt = 'Change Fits? (y/n): ') root.quit()

This is literally all I do for tk. My impression that root.quit() was supposed to close the box.

modern marsh
#

and according to docs, only one instance of Tk() should be present for a program
consider using one Tk() and others can be Toplevel()'s
i am not very sure of this though

viscid sluice
#

Hey! I am hopping that someone could explain how the PyQt5 licensing works? In my particular use case, I developed an gui to visualize some data captured from sensor. If I make the software opensource under MIT licence can I still sell the executable without needing a commercial licence for PyQt5? The software is also tide to the hardware so could I just sell the hardware and then offer the software for free?

modern marsh
#

Idk PyQt5 license exactly but you can just change the imports to PySide 2 and it will work the same with some small changes needed

digital rose
#

please help

digital rose
digital rose
#

Welcome!

#

Sorry for long response

normal frigate
#

It's fine :)

#

Just rlly need this problem solving

drifting palm
#

anyone who knows how to make gui with qtdesigner and use it in a python program dm me need help, might pay

ionic moat
#

that's too vague

#

just make your gui and use pyuic it that's it

abstract relic
#

hey does someone have some experience with kivy and Kivymd

#

stuck at a problem

digital rose
#

Im using matplotlib but when i use py plt.show(block=False)
but when i use it , the window crashes as it runs the rest of my program

autumn badge
#

sweet shit!! i got nuitka to work with appjar today (i hope). will do a final test tomorrow to swee if it works on a computer without python

tender roost
#

can someone tell me why this isnt working?

#

u see the first box

#

its supposed to be styled to the styling i pu

#

put

#

idk why its not working

#

this is using the pyqt5 designer app

winter folio
#

does anyone know how to remove an uninstalled shortcut from the bash source file on linux ubuntu?

unique forge
#

it should be on the top line

tender roost
modern marsh
#

is it QLinearGradient maybe?

unique forge
unique forge
modern marsh
#

oh alright

unique forge
#

the problem is you're using border-color

#

you need to do it like this

#
border-left: 1px solid qlineargradient(bla bla bla);
border-right: 1px solid qlineargradient(bla bla bla);
border-top: 1px solid qlineargradient(bla bla bla);
border-bottom: 1px solid qlineargradient(bla bla bla);
tender roost
#

ill try it out

unique forge
tender roost
#

what are the parameters qlinear gadient takes?

#

is it

#

just three values

#

its a gradient

#

wos

#

os

#

so

#

where do i put the other values

remote ruin
#

Hello. I was wondering if anyone here could help me with problem i encountered. I'm trying to open multiple (2 atm) windows, but somehow its not working. I tried looking through the stack and docs, but I cant find solution to my problem. If anyone is capable of helping me with my problem, answer. Thanks pepeMLADY (btw im using pyqt5)
sc: https://pastebin.com/GX65K0ah

plush stream
#

@remote ruin have you tried to instantiate the EdupageClientIndex class inside the EdupageClient and then put .show() on that class instance?

#

Here's an example

	def __init__(self):
		super(MainWindow, self).__init__()
		self.secondWindow = SecondWindow()
		self.secondWindow.show()



class SecondWindow(QWidget):
	def __init__(self):
		super(SecondWindow, self).__init__()
remote ruin
digital rose
#

Good day, all! I've got a peculiarity with PyQt 6 I'm working through.

#
    def current_weight_edit(self):
        current_weight = QLineEdit(self)
        current_weight.setPlaceholderText('Current Weight')
        validator = QDoubleValidator(50, 99, 2, current_weight)
        current_weight.setValidator(validator)
        current_weight.editingFinished.connect(partial(self.user_setup, current_weight=current_weight))
        return current_weight


    def user_setup(self, username=None, name=None, starting_weight=None, current_weight=None, height=None):
        if username != None:
            self.user.username = username
            print(f'Username is {username}')
        if name != None:
            self.user.name = name
        if starting_weight != None:
            self.user.starting_weight = int(starting_weight.text())
            print(f'Starting weight is {starting_weight.text()}')
        if current_weight != None:
            self.user.current_weight = int(current_weight.text())
            print(f'Current weight is {current_weight}')
        if height != None:
            self.user.height = int(height.text())
            print(f'Height is {height}')
#

In the current_weight_edit function, I have the signal to connect to the function below and originally I wanted to just send current_weight=current_weight.text()

#

but always sends a blank string

#

The only way I can get it to work is to pass the entire object and then do the text() inside user_setup

modern marsh
#

does anyone have any example of how to delete some widget after a set amount of time in PyQt5? if so, please link the site/vid to me

#

thanks :)

normal frigate
#

Hey, so I'm quite new in Python Tkinter, and I'm currently making a 5-Question Geography Quiz. However; I can't seem to figure out what's going wrong in a certain bit of my code. So basically, the first question, if the user selects the correct answer, I want the program to output a Label saying "Correct", but then I also want a delay in between the Label showing and the window closing and moving onto the next question. When it's ran, I click submit on the first question after selecting the correct answer, and the button stays pressed down for the 2 seconds I set it for, but doesn't show the Label saying "Correct". Here is the code: https://paste.pythondiscord.com/teravoleme.apache

keen oracle
#

How bad is it to make a 2d game in tkinter instead of pygame?? I'm a beginner but I already think I can do it with just what I know in tkinter

edgy lintel
#

it do be like that sometimes

untold lichen
#

anybody interested in chrome specific python applications

#

things like pycharm

#

wait not that lol

#

selenium IDE i mean

#

brain fart lol

digital rose
digital rose
digital rose
# normal frigate Hey, so I'm quite new in Python Tkinter, and I'm currently making a 5-Question G...

The code practice you displayed here is quite inefficient. If you make separate functions for each question, it will take you hours to make a 10 minute application. instead you can do something like:
questions=["q1","q2"] answers=["a1","a2"]
now, when you wish to display questions, simply create a label, situated at the top of the window, aligned to the center.
qLabel = Label(window,text=questions[0], font=("DejaVu Sans Mono", "12", "bold")) qLabel.place(x = 400,y=0)
just an example, to show how you create a main label for displaying questions.

#

now, instead of creating a new window everytime, you simply configure the text of the tk label to change to the next question, everytime you either choose the correct option, or the wrong one.

#

you can record the index of the questions list, so that you just increment the index, and then update label text:
index=0 # at the starting. ... if answer is correct, index+=1 qLabel.configure(text = questions[index])

#

@normal frigate

modern marsh
modern marsh
keen oracle
# grand mica Use pygame

How is it better? I think all what I need is movable editable transperant images and tkinter was smooth when I tested it

#

I just load like 50 images at first xd

grand mica
grand mica
digital rose
#

Its disabled the active mode after the mouse not over the widget try that and see

#

I dont know why tkinter library devs do that but may be important sometimes

#

So make your own bg and fg instead

digital rose
digital rose
digital rose
dry moat
#

How can I create an interface that works by buttons? three buttons to be exact. 1 that goes up, another that goes down and one that accepts.

normal frigate
dry moat
unique forge
#
dry moat
# unique forge why dont you learn PyQt5

It seems like a good method to make the interface, now we only need to know how to program the interface so that it functions by means of three buttons, one that goes down, one that goes up and another that accepts.

unique forge
dry moat
#

yes

unique forge
#

it has a page on how to make buttons

#

or, you can always use Qt Designer

digital rose
#

@dry moat doesnt matter which library you use. PyQt5 is great, and so is tkinter. but tkinter stands out from the rest because its easier and far more flexible.

wooden imp
#

As someone who has never worked with Python User Interfaces before(have plenty of experience in other Languages), what is the difference between pyqt and pyside?(aside from the License)

digital rose
wooden imp
digital rose
#

Under pyqt

wooden imp
#

GPL does not forbid commercial use, just proprietary.
PyQT's FAQ says:

Do I need a commercial PyQt license?

It depends entirely on what license you are going to use to distribute your application. If your license is incompatible with the GPL then you need a commercial PyQt license. If your license is also incompatible with the LGPL then you also need a commercial Qt license. (Note that some parts of Qt, QtCharts and Qt Data Visualization for example, are licensed under the GPL rather than the LGPL.)```
If I understood this correctly and I have no reason to believe I didnt then this means that you do not need a commercial license to use pyqt commercially if your commercial use is GPL compliant
#

Still this all has nothing to do with my Question of what the practical difference between the two is.

rugged patio
#

you just cant make money with the normal one

worthy ridge
#

the licences are carry forward

wooden imp
#

Nothing in their License says that. GPL can absolutely be used commercially( https://www.gnu.org/licenses/gpl-faq.html#GPLCommercially )

Example of this would be A paying B to program FizzBuzz. B develops FizzBuzz but uses a GPL Library to do so. To account for that B will release FizzBuzz under the GPL License which means that when distributing it to A, A will receive the source code and is free to redistribute FizzBuzz, but neither A nor B has to distribute FizzBuzz to the world(but are allowed to if they wish to do so).


But all of this has nothing to do with my question:

What is the difference between PyQt and PySide in practical application? Are there any functional differences?

sudden coral
#

Yes there are

stray coral
#

@stuck vine I found this article pretty helpful: https://www.learnpyqt.com/blog/pyqt6-vs-pyside6/
I just swapped from PyQt5 to pyside6 and the conversion of my project was not very painful. As to practical differance pyside allows for example snake_case as shown in the article.

sudden coral
#

Each has some gaps in their implementations of Qt functions

#

Official docs have the list

stray coral
#

also some different namings in some cases.
PyQT its pyqtSignal, pyqtSlot and pyqtProperty, while pyside its Signal, Slot and Property

#

I have a Qt question.

How to manage drag and drop when you have multiple QLists, QTrees and QTable widgets?

I need my top table to drag to the bottom Channel Lists.

So dragging "Crow calls" to the bottom left Bird Calls channels QList.
I also need to drag from the scenes Qlist to the groups QTree.
And disallow any other drag and drop behavior, meaning no dragging from the top audio_file_table to the groups_tree.

I assume I could do this by re implementing the dropEvent() and check origin but wondered if there is a simpler way?

#

in other words I need to disallow drops from certain sources.

sudden coral
#

Have you tried setting the ItemFlags?

#

Does that only work globally?

#

Yeah, probably. I can't think of anything else besides overwriting the event then

stray coral
#

Think I might have to get into dropEvent regardless, since want some very specific behavior. Just gonna read up on the docs. .

unique forge
#
stray coral
#

He does both Tkinter and PyQt, but I have only watched his pyqt5 videos and they have been a great resource for me at least

digital rose
#

Can someone help me with a gui

#

c# or python idm

#

Like this

#

but obv without the ddos panel part

#

I'm on iMac

nocturne zealot
#

wtf....

digital rose
#

what?

#

lol

#

Skids these days

#

i dont want the ddos tool lmao

#

Just the Gui

fallen copper
#

the george floyd decorated gui?

#

nice bro..

unique forge
#

@digital rose bruhhhhhhhh

#

btw yes, you can

digital rose
#

Shii

#

Can you send me a dm ill work on it tmrw

unique forge
#

no I will not send you a DM

remote ruin
#

Hello. I'm trying to open multiple windows, but somehow its not working. Show in class EdupageClientIndex is terminating it (at least i think, because when i remove it, app wont exit with code 0). If anyone here knows the solution for my problem, hit me up. Thanks
I'm using pyqt5
sc: https://pastebin.com/hFwp5NSz

iron mural
#

whats the best thing to use to make a modern design for a gui for py

modern marsh
#

PyQt5

#

with QtCreator or QtDesigner for making quick, beautiful GUI's

shy sapphire
#

what is the best way to create a UI for a python program

modern marsh
#

use a GUI module like PyQt5, Kivy or tkinter

#

and some more

unique forge
#

oops replied to wrong person

modern marsh
#

lol

modern willow
#

Xd

dry moat
#

I mean, for doing simple UI

#

That can interactuate with gpio ports from a Raspberry Pi and some Shell commands

#

I just want a UI with some text and rectangles, nothing very complex

ionic remnant
unique forge
#

It's very frustrating to use, and it looks like the 1990s

#

and the stylesheets are not as advanced as Qt to make it look modern

ionic remnant
#

oh ok

proper oar
unique forge
#

@proper oar what's this for?

proper oar
#

pyqt5 pyside2 and pyside6

unique forge
#

what's it for though

#

I was talking about how Tkinter has bad stylesheets compared to PyQt

proper oar
#

ohh my bad i must have read that wrong

unique forge
#

I didn't say PyQt had bad stylesheets, I said it had good stylesheets!

#

thanks anyway

proper oar
#

no worries

modern marsh
#

How do I add the properties to a button, like it changing colour while hovering on it , etc without using QSS or QtQuick?

#

That is, just the PyQt5 module

digital rose
#

In my opinion, "PyQT5" and their series aren't a good UI making software.

modern marsh
#

Oh, why so

digital rose
#

Because there are better options.

modern marsh
#

Like?

digital rose
#

I have my own UI interface module, which I think is the best UI making software to make desktop applications.

modern marsh
#

Umm ok

#

Available for the public?

digital rose
#

The module?

modern marsh
#

Ye

digital rose
#

Only for Equant Engineers.

modern marsh
#

Oh alright

digital rose
#

I can show you some examples.

modern marsh
#

Any alternative to Qt that is also Available for the public

#

?

#

I have seen your UI's

digital rose
#

Oh ok.

#

Did you like them?

modern marsh
#

Yes

digital rose
#

Not really, I recommend to not use a designer, like "PyQT5" and start from code.

#

Because from there, you can start learning advanced graphics, and learn how to use advanced shading.

modern marsh
#

Code??

digital rose
#

I made my module in C++, since it's much more fluent in algorithms.

modern marsh
#

Qt is in C++ too

digital rose
#

I don't recommend it.

#

My module for C++ will be public, how ever, Equant will be making our own coding language to make desktop applications, which the module will be released there.

modern marsh
#

Nice

digital rose
#

Anyone know if matplotlib and PyQt6 play well together?

digital rose
#

My tkinter gui window isn't responding once I press a button

modern marsh
digital rose
#

I'm accessing website and downloading media using requests

modern marsh
#

yeah , try using threading to solve the problem

hushed ingot
#

im trying to make a ui with pyqt and want to know why the dialog is immediately called instead of there being a login button to call it

class MyWindow(QMainWindow):
    def __init__(self):
        super(MyWindow, self).__init__()
        self.setWindowTitle("Chat Application")
        self.setGeometry(0, 0, 400, 400)
        self.name = ""
        self.LOGIN = False
        self.initUI()

    def initUI(self):
        while True:
            self.label = QtWidgets.QLabel(self)
            self.label.setText("A Label")
            self.label.move(100, 100)
            if not self.LOGIN:
                self.dialogbtn = QtWidgets.QPushButton(self)
                self.dialogbtn.setText("Login")
                self.dialogbtn.clicked.connect(self.showDialog())


    def showDialog(self):
        text, ok = QtWidgets.QInputDialog.getText(self, "Username", "Please enter a username here")
        if ok:
            self.LOGIN = True
            self.name = text
modern marsh
#

what you should do is - connect(self.showDialog)

digital rose
#

Tkinter is easier than any other lib, especially QT.

#

Not that im being biased or anything, its just the best for beginners, or atleast for people who wish to make simpler UI.

#

It might look old-fashioned, but theres a lot of stuff you can do to make modern styled spreadsheets.

#

Its just that no one wishes to look into it, its their ego that stops them ๐Ÿ˜‰

unique forge
#

@modern marsh you should stick with Qt

unique forge
#

also, Qt has Qt Designer and Qt Creator for easy drag and drop UIs

modern marsh
#

yeah Qt is better than tkinter ofc

#

py devs in their talks themselves say about limitations that tkinter has

#

the only good thing that i can find about tkinter is that it comes with py therefore, no extra dependencies

#

and about tkinter being easier than Qt, yes, for simpler GUI's

#

but hell na, for complex stuff

digital rose
modern marsh
#

sleep?

#

oh like, time.sleep()

digital rose
#

Yes

modern marsh
#

there is a tkinter_object.after() for that

proven basinBOT
digital rose
#

the code is here

lost dragon
#

What is better and why (to for example, change the text of a Label in tkinter)

import tkinter as tk

root = tk.Tk()
label = tk.Label(master=root, text="Hello World!")
label.pack()

root.after(0, lambda: [label.configure(text='Hi')])
root.mainloop()

Or

import threading as t
import tkinter as tk

root = tk.Tk()
label = tk.Label(master=root, text="Hello World!")
label.pack()

update_thread = t.Thread(func=lambda: [label.configure(text='Hi')], daemon=True)
update_thread.start()
root.mainloop()
amber roost
#

@lost dragon Definitely the after method; accessing widgets from other threads has a chance of causing very unexpected behavior and errors. If you are working on thread communication, I recommend a queue a self-rescheduling after method checks repeatedly and a thread writing into the queue. This way the thread will never access tk widgets.

lost dragon
digital rose
#

is there any way i run threads again and again

amber roost
lost dragon
#

oh ok thanks!

amber roost
digital rose
#
# IGTV
igtv_window = Toplevel(root)
igtv_window.title("DOWNLOAD IGTV VIDEO")
igtv_window.geometry("1100x600+50+10")

bg = PhotoImage(file="IG.png")
f = ("CALIBRI", 20, "bold")

label4 = Label(igtv_window, image=bg)
label4.place(x=0, y=0)

canvas4 = Canvas(igtv_window, width=400, height=400)
canvas4.pack(fill="both", expand=True)
canvas4.create_image(0, 0, image=bg,  anchor="nw")
#canvas4.create_text(400,250,text="Enter URL:",font=("Helvetica", 20), fill="white")
igtv_url_lbl = Label(igtv_window, text="Enter URL :",
                     width=20, font=f, bg='#8a3ab9')
igtv_url_ent = Entry(igtv_window, width=20, font=f)
igtv_url_lbl_canvas = canvas4.create_window(
    350, 100, anchor="nw", window=igtv_url_lbl)
igtv_url_ent_canvas = canvas4.create_window(
    350, 200, anchor="nw", window=igtv_url_ent)


button_igtv = Button(igtv_window, font=f, width=20,
                     text="DOWNLOAD IGTV VIDEO", command=threading.Thread(target=downloadigtv).start)
button_igtv.pack(pady=20)
# button_igtv.after(3000,button_igtv.destroy)
button_igtv_back = Button(igtv_window, font=f, width=20,
                          text="BACK", command=lambda: back(3))
button_igtv_back.pack(pady=20)

amber roost
digital rose
#

okay thanks

digital rose
digital rose
unique forge
digital rose
#

You need to do that while making GUIs.

#

You need the perfect position of course.

unique forge
#

not with Qt Designer

#

also, tkinter just doesnt look good

digital rose
#

ยฏ_(ใƒ„)_/ยฏ

unique forge
#

the only good thing about tkinter is you dont have to download it

digital rose
#

Why do you think it doesnt look good? and do you not know how to make it look good?

unique forge
#

it looks like the 90s, and the stylesheets aren't good enough to make it look modern

digital rose
#

Plus, i dont see a** BIG** difference in how QT's core UI looks and that of tk

#

style sheets is a whole new topic. Core UI is what I talk of.

unique forge
#

yeah, then they look similar

#

but Qt is just easier

#

and more advanced

digital rose
unique forge
#

Qt has more features

#

than tkinter

#

PyQt is easier because first, it has a drag and drop Designer

digital rose
#

That is not related to programming in any sense.

unique forge
#

second, PyQt doesnt need to be packed, or putt in a grid, you just make the widget

#

and it shows up

digital rose
#

Any recommendations on a graphing library to pair with PyQt? I wanted to use Matplotlib, but they haven't updated for Qt6

unique forge
#

Qt5 and Qt6 are pretty much the same

digital rose
#

but the windows are freezing

#

Try putting the command for the button in a separate function, rather than Lambda.

amber roost
digital rose
#

Thanks, Famous8, but I'd rather just stick with 6. I'm open to any library that works with Qt6.

#

If there aren't any, I'll downgrade, though.

digital rose
#

Hey guys, i'd like to make a small UI in terminal with a margin on top and a margin on bottom where some variables values will be show and refreshed every X milliseconds
In the middle of that i'd like to see the standard prints of my program
Do you have any idea on how to achieve that ? I've seen curses library but i'm not sure it's what i'm looking for

digital rose
#

Ok so i've almost found wjat i was looking for with https://github.com/willmcgugan/rich
The following code is working well except for the middle part

from rich.layout import Layout
from rich.live import Live
from rich.text import Text
import time

text = Text("Hello, World!")
text.stylize("bold magenta", 0, 6)
layout = Layout()
layout.split_column(
    Layout(name="upper"),
    Layout(text, name="middle"),
    Layout(name="lower")
)
i = 0
with Live(layout,  refresh_per_second=10):
    while True:
        layout["upper"].update(str(i))
        text.append("\n"+str(i))
        i += 1
        time.sleep(0.001)
        layout["lower"].update(str(i))

I can't find a way to clear the middle part text so the newer lines can't be displayed
here's the output

#

in the middle part (from Hello World to 5) we should see something like

1768
1769
1770
1771
1772
1773```
digital rose
digital rose
# digital rose yeah worked well thanks

nice. even though obfuscated code, something like this:
# getting an array of only odd numbers from 1 to 10 odds = [i for i in range(1, 10) if i%2!=0]
might seem like a good practice but it isnt.

#

code, that uses obscure language features is something neither meant to be put into production, nor is readable or maintainable.

digital rose
#

ah nice I hate arrays

remote violet
#

I have made an desktop app in Adobe XD and Iโ€™ve made a script in python but now I want to connect those two. Whatโ€™s is the best/easiest way to do this?

digital rose
#

Yeah obscure code just looks like small but it's not that good

#

Got it

digital rose
remote violet
#

Iโ€™ve created a UI in Adobe XD and I have created a webscraping tool in Python but now I want to connect those so if I write a SKU of something in de desktop app it will appear at a soecific place in my script!

digital rose
#

why have you created the UI in adobe xd? does it serve a specific purpose?

#

you might want to get your hands on some utility library that helps you deal with .xd files.

#

@remote violet

remote violet
digital rose
#

do you wish to get some data from the UI itself?

remote violet
#

Like if I have a form in my UI that if I fill that it fills a specific place in my script

#

Like if you enter information for a mailing list

#

(Sorry but Iโ€™m not good at explaining things)

digital rose
#

"fills a specific place in my script" why are you trying to show data in the python script? that data should be written to something like a txt file.

remote violet
#

So that if a user puts his information in a form (like name and email etc) it will fill it in my python script so my script can run with the information of the user

digital rose
#

Ahh

#

I get you

#

So basically what you need to do is simply grab the data of the form, and write it to a text file, and name it something like userinfo.txt. now, everytime the user opens the form, you can access the text file, and fill in the details from it.

remote violet
#

Kind of but it needs to happen automatically

digital rose
#

"automatically"?

#

you can throw in some popup asking the user to save info, like a couple of browsers do.

#

then only trigger the function that saves information into the text file.

#

check out xdtools to work with .xd files.

remote violet
#

email =
first_name =
last_name =
Category =

#

like this

remote violet
#

lemme look

#

dont really understand what it does

digital rose
#

why dont you try doing something to get data in XD itself?

remote violet
#

How do you mean?

#

Parts of my python script?

#

@digital rose

digital rose
#

I believe there is a way to add a command to buttons?

#

Maybe just learn a UI lib in Python instead! ๐Ÿ˜…

remote violet
#

Iโ€™m gonna look into it

#

Thanks for your help

viral nimbus
#

Hey, i want to assign multiple functions to a button but the second function doesnt execute when i click the button. It works when i only connect the second function to the button. That's the code snipped:

ui.button_start.clicked.connect(lambda: bot.accept_request(loop=True))
ui.button_start.clicked.connect(lambda: ui.button_start.setText("Stop"))

i already searched on the internet and they say that it should work, but it doesn't :(

I'm happy about every answer! :)

icy totem
viral nimbus
#

@spiral karma stop spamming

viral nimbus
#

even when i dont click the button

#

ah i forgot the brackets

#

but it still doesnt modify the button

icy totem
# viral nimbus thanks, but it executes the function

๐Ÿ˜ฆ
I just realised, I didnt commented my previous instruction. I added a print as second function:
self.aboutButton.clicked.connect(self.showDialogApp) self.aboutButton.clicked.connect(lambda: (self.showDialogApp, print("Button pressed!")))

#

Commenting the first line does not really perform both functions ๐Ÿ˜ฆ

viral nimbus
#

oh lol i figured it out

#

it actually changes the button text but it only updates when the second function is finished

#

is there a way to refresh a button manually?

#

like

    ui.button_start.setText("Stop")
    win.refresh()
    function_that_takes_long()
wooden imp
#

So I am looking into writing a generalistic form for pyqt that takes in a SQLAlchemy object renders it in an editable way and then returns the(possibly) changed object when pressing save.
Before I spend a sizable amount of time for that I would be interested whether or not that is already implemented by someone in a convenient to use way

ivory ember
wooden imp
#

Unfortunately there is no way to not use SQLALchemy and use build ins. Its a desktop frontend for an already existing system. What I am seeking to emulate is djangos ModelForm(https://docs.djangoproject.com/en/3.1/topics/forms/modelforms/) because I am dealing with approx 20 different models and I have 0 Interest in writing forms for each.

kindred canyon
#

How can I make 3 text boxes with each labeled and then whatever you have inputted for the boxes go in their respected variables. Then you press a start button to enter the vars and go with the rest of the code.? Tkinter btw.

viral nimbus
#

hey, I have a GUI that has a button and when i click the button it changes the text to stop and runs a Selenium session, but i want to kill that session when i click the button again, I dont know how i can do that. that's my current code:


    # Display gui
    app = QtWidgets.QApplication(sys.argv)
    win = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setup_ui(win)

    start_btn = ui.button_start

    start_btn.clicked.connect(
        lambda: (accept_request_thread(), start_btn.setText("STOP" if not start_btn.text() == "STOP" else 
    "START"))
    )


    def accept_request_thread():
        if start_btn.text() == "START":
            bot = Bot()
            t = threading.Thread(target=lambda: bot.accept_request(loop=True)).start()
        else:
            print("Closing driver because text is", start_btn.text())
            bot.driver.quit()


    win.show()
    sys.exit(app.exec_())
patent cave
#

Can someone give any opinions regarding PySide vs PyQt? I know Qt itself well and have done a lot with PyQt back in the day. I haven't used Qt nor PyQt that much for a few years and it seems that Qt itself pushes PySide. Does it do something better than PyQt?

digital rose
#

when i disable a button in tkinter how can i make it not grey out

plush stream
digital rose
digital rose
#

this will make the button not do anything, but is not greyed out at the same time.

prisma citrus
#

Any way to integrate a command line interface in a Python GUI app?

digital rose
#

how do you want to integrate them?

prisma citrus
#

Background color kwarg, if I am right

latent compass
#

lemme try

prisma citrus
#

@latent compass works?

latent compass
#

dont think so

prisma citrus
#

What did u do?

latent compass
#

just add **kw

prisma citrus
#

Ouch

#

kw

#

Do u know what that does?

latent compass
#

just vs showed it ๐Ÿ‘๏ธ

prisma citrus
#

No?

#

Wait

#

U wanna make it transparent?

#

U can't make it transparent....

latent compass
digital rose
#

do you want to add some color to the widget background?

#

@latent compass

latent compass
#

no i want to make it transparent

digital rose
#

yes you can do it. @latent compass

#

see this:
`# tkinter example, changes window bitmap to a transparent style:

21 July, 2017

from tkinter import *
__window= Tk()
__window.config(bg="white")
__window.wm_attributes("-transparentcolor","white")
__window.mainloop()
`
so now whenever you set the window color to white, it makes the window transparent.
PS: Works only on Windows.

#

for macOS:
__window.wm_attributes("-transparent",True)

#

now, to make the widget transparent:
# for windows: __window.wm_atributes("-transparentcolor","white") button=Button(__window,text="click me",bg="white") button.pack()

#

`

for macOS:

__window.wm_attributes("-transparent",True)
widget.config(bg="systemTransparent")
`

prisma citrus
#

Oh

#

@digital rose is there a documentation about the list of wm_attributes() kwargs?

#

Sorry for the ping ^^^

digital rose
prisma citrus
#

Oh, ok thanks!

digital rose
prisma citrus
#

And about the **kwargs?

#

Every widget has

digital rose
#

then visit the tk docs

prisma citrus
#

Oh

digital rose
#
prisma citrus
#

BTW, what's the difference between tk and tcl?

#

Do u know?

digital rose
#

Tcl is a scripting language. Tk is a GUI creator for Tcl.

prisma citrus
#

Oh

#

Lol

#

Thanks for telling!

digital rose
#

you can embed windows in tkinter Frame().

prisma citrus
#

@digital rose windows command prompt?

#

How?

digital rose
#

you can embed a pygame window in a tkinter frame.

#

or any other python window atleast.

digital rose
prisma citrus
#

Oh ok

rugged marsh
digital rose
#

@rugged marsh you can post your query here.

rugged marsh
#

Oh my problem was solved already. Thanks though :)

digital rose
#

no problem.

ripe igloo
#

tkinter seems to not want to work with a while true loop

#

even though i initiate the instance before starting the while true loop

#

it just doesnt want to open a window up

#
from tkinter import *

def getchat(file):
    file.seek(0,1)
    while True:
        line = file.readline(0)
        if not line:
            continue
        elif "[Client thread/INFO]: [CHAT] ONLINE:" in line:
            getstats(line[49:])
        elif "[Client thread/INFO]: [CHAT] Your new API key is" in line:
            recieve_api_key(line[61:])

def main():
    print('maining') #debug line
    getchat(open(os.getenv("APPDATA")+"/.minecraft/logs/blclient/minecraft/latest.log", "r"))

root = Tk()
main()```

when i ran the code before i added in the call to `main()` the gui would launch
#

after it just doesnt launch

#

i dont get any errors

#

it just doesnt launch the gui

digital rose
#

so youre just trying to read from a text file?

#

with tkinter?

#

@ripe igloo

ripe igloo
#

well i was planning to do something with the stuff in the text file

#

and then display it with tkinter

digital rose
#

ah

#

reading from a text file is like a one liner.

ripe igloo
#

its just that i literally cannot get the little tkinter box to open up no matter how hard i try

#

with the call to main()

digital rose
#

like this:

lines=open("test.txt").read().splitlines()
#

this gives you a list of lines in the text file.

digital rose
ripe igloo
#

this little thing

digital rose
#

this is the window.

#

it must mean that the code before instancing the window doesnt work.

ripe igloo
#

except i dont call any code before instancing it

digital rose
#

before you create the root window, you call in some code.

#

namely the getchat() function.

ripe igloo
#

i put it right underneath the imports

#

it still refuses to work

digital rose
#

is that the full code?

ripe igloo
#

ill mystbin the full code

#

even running it like this doesnt work

#

it goes right to main

digital rose
#

put in root=Tk() before the main() and add root.mainloop() at the very end.

ripe igloo
#

no dice

digital rose
#

?

ripe igloo
#

didnt work

digital rose
#

i said root.mainloop() at the very end.

#

after input

ripe igloo
#

ah

#

ok i see the problem

#

mainloop has some sort of while true loop or smt

#

because i put mainloop before main and main doesnt run but tkinter does

#

i put main before mainloop and tkinter doesnt run

digital rose
#

yes.

#

mainloop() keeps the window running.

ripe igloo
#

so id have to async this somehow huh?

digital rose
#

nah.

#

mainloop() is fine.

ripe igloo
#

its one or the other

digital rose
#

is your code working now?

ripe igloo
#

its either main or tkinter so no

#

ill try to hack this together somehow

#

thanks for the help!

digital rose
#

no need to.

#

is it creating the window now?

ripe igloo
#

it creates it if i put mainloop before main

#

but then main doesnt run

#

it's fine, I'll find a way to put it together

digital rose
#

it needs to be at the end.

ripe igloo
#

doesn't work that way

digital rose
#

you cant call something after it.

ripe igloo
#

if I put it after main it doesn't work

#

it's fine, I'm gonna take a break and come back to it in the morning

#

thanks!

digital rose
#

sure.

#

you can ping me.

exotic mauve
#

hi guys should i use pyqt5 or pyqt6?

#

nvm im gonna use pyside6

exotic mauve
#

i wanna ask do i need to install qt from qt.io? I think i can access the designer just by typing "pyside6-designer"

#

oh wait do i need qt creator

exotic mauve
#

nvm i dont think i do

#

thanks for the help guys

#

now how do i package it to a .exe?

#

all scripts with dependencies

modern marsh
#

well, there is pyinstaller but i dont think that is recommended