#user-interfaces

1 messages Β· Page 78 of 1

tawdry mulch
#

Idea on?

digital rose
#

things to add

#

widgets

pearl yarrow
#

just need to wait two seconds for it to update

digital rose
#

colour

#

positioning

tawdry mulch
#

Looks fine to me, though it would be better if doesnt have that empty space

digital rose
#

Yeah

tawdry mulch
#

Title of the app, more data on when the reminder expires, bla bla

digital rose
#

im just doing the UI

pearl yarrow
#

LOLLL

digital rose
#

cause i have to work on my other software as well

#

πŸ˜…

pearl yarrow
#

I delete line time.sleep(2)

tawdry mulch
#

I wish I had someone to design UI for me πŸ˜›

pearl yarrow
#

and it work!

digital rose
tawdry mulch
pearl yarrow
tawdry mulch
#

That was just an example...

#

What is the code that you have now

tawdry mulch
# digital rose :(

Always wanted to ask someone, what is the character after your name, after the ' | ': α˜‘α˜α—’

pearl yarrow
#

it is quite large it is problematic to rake it out the main thing is that everything works

tawdry mulch
#

Happy/Confused to know it helped πŸ˜„

digital rose
#

Well its part of the Cat Cult

tawdry mulch
#

A lot of people over here have it, thats why I asked

digital rose
#

Those who do joined the Cat Cult

tawdry mulch
#

What is that though

digital rose
#

The supreme Cult of Cats,

pearl yarrow
#

to be honest, ProgramWindow. update () apparently this line helped

digital rose
#

A community which is revolved around helping and getting help

#

When you add the Cats symbol in your name, you are acknowledging yourself as part of the Cult

#

Your job is to help and ask help frequently

#

And as a member of the Cat Cult it is your job, to never remove the symbol

#

Basically

#

Its just a cat symbol lol

tawdry mulch
#

πŸ˜‚oh okay

pearl yarrow
#

it is clear that this did not block the editing of the size but the very fact of clicking on the button(expand window)

tawdry mulch
#

πŸ‘πŸ‘

pearl yarrow
#

thanks

#

the topic is closed((

gaunt willow
#

Name easiest library for ui

digital rose
#

Hey I didn't know how to google this. (Tkinter)
How do I change to a different "window" as in like a settings menu. I don't want to have 2 windows open.
So in a menu I click on Settings for example then I see all my settings and when I click back I'm back to my main menu.
I want to stay in the same window not have settings as a popup extra window. But Menu and Settings have 2 completly differnt sets of buttons/backgrounds ....
Idk if this is understandable πŸ˜…

tawdry mulch
tawdry mulch
simple heart
#

is there any way to change the colours of the buttons? (using tkinter)

#

and like, the style too

#

it just looks so boring

#

and doesnt fit the windows 11 style lmfao, probably hard to do with it but its all i know 🀷

lime monolith
simple heart
#

thanks!

digital rose
#

How do i center the +

#
        self.pushButton = QtWidgets.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(60, 60, 151, 141))
        font = QtGui.QFont()
        font.setPointSize(110)
        self.pushButton.setFont(font)
        self.pushButton.setObjectName("pushButton")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.label.setText(_translate("Dialog", "Create New Project"))
        self.pushButton.setText(_translate("Dialog", "+"))
proven basinBOT
#

apollo/plugins/app_theme/mainwindow_apollo.css line 1154

/* footer_PSB_prev */```
pallid arch
#

any one tkinter expert here?

#

Widgets Change position on enable other frame..

#

When I want to make a graph by enter submit button.. It shows me graph but my entry labels make spaces in y-axis... Changes it own postion

#

NOtebook, 4 frames columns wise.. Grid layout system.. Can share my code on demand.. very much lines of code I cannot take screenshot..

tawdry mulch
#

Can you try ttk widgets with W11 and tell me if it gives the W11 style or if it is still W10 type. Not much of hope because W11 uses the same kernel as W10

tawdry mulch
#

If you still cannot figure it out, give me a zip file with all the files that are needed to run your code exactly like you are able to run. I'll take a look

solar ether
#

I have a problem with Pyside6

#
ModuleNotFoundError: No module named 'PySide6'``` I've had this error for days.
#

Can someone explain it to me?
I have it installed already.

tawdry mulch
#

Sure?

solar ether
#

Yes

#
Requirement already satisfied: PySide6 in c:\users\raxos zero\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (6.1.2)
Requirement already satisfied: shiboken6==6.1.2 in c:\users\raxos zero\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (from PySide6) (6.1.2)```
plush stream
#

Do you use any kind of IDE?

solar ether
#

Hmm. Just VS Code.

tawdry mulch
#

Prolly you use Pychar,

#

Oops, okay then check which python you are installing to

solar ether
#

3.9

plush stream
#

Make sure to inherit the global package from Python root directory

tawdry mulch
#

Which python does VSC run

plush stream
#

I'm guessing you're using venv?

tawdry mulch
#

What does it say on the bottom corner of VSC

#

Send a screenshot of your Visual studio code window

solar ether
solar ether
tawdry mulch
tawdry mulch
solar ether
tawdry mulch
solar ether
plush stream
#

Pretty sure it will also work on tkinter if there's a way to make the window translucent/transparent and get the winId inside tkinter

tawdry mulch
tawdry mulch
plush stream
#

Idk how to make the window transparent though

#

I rarely use tkinter

tawdry mulch
solar ether
tawdry mulch
plush stream
tawdry mulch
tawdry mulch
solar ether
solar ether
#
aiohttp==3.7.4.post0
appdirs==1.4.4      
async-timeout==3.0.1
attrs==21.2.0
certifi==2021.5.30
chardet==4.0.0
discord.py==1.7.3
distlib==0.3.2
filelock==3.0.12
idna==2.10
Jinja2==3.0.1
MarkupSafe==2.0.1
multidict==5.1.0
PyQt5==5.15.4
PyQt5-Qt5==5.15.2
PyQt5-sip==12.9.0
PyQt6==6.1.1
PyQt6-Qt6==6.1.2
PyQt6-sip==13.1.0
PySide6==6.1.2
qt-material==2.8.8
requests==2.25.1
shiboken6==6.1.2
six==1.16.0
typing-extensions==3.10.0.0
urllib3==1.26.6
virtualenv==20.4.7```
tawdry mulch
#

Hmmmm it shows that it is installed

solar ether
#

Exactl--

#

Wait

tawdry mulch
#

Okay do one thing, click on that python version thingy and change your version to what was shown in the cmd

#

then try the code again

solar ether
#

Yeah, that's what I went to do...

#

But

#
  File "c:\Users\Raxos Zero\Documents\GitHub\VeryHarassiveAndKinkyStalkApp\src\main.py", line 35, in <module>
    window = MainWindow()
  File "c:\Users\Raxos Zero\Documents\GitHub\VeryHarassiveAndKinkyStalkApp\src\main.py", line 11, in __init__
    self.init_config()
  File "c:\Users\Raxos Zero\Documents\GitHub\VeryHarassiveAndKinkyStalkApp\src\main.py", line 21, in init_config
    self.settings = self.init_settings()
  File "c:\Users\Raxos Zero\Documents\GitHub\VeryHarassiveAndKinkyStalkApp\src\main.py", line 17, in init_settings
    with open("config.json", "r", encoding="utf-8") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'config.json'```
tawdry mulch
solar ether
#

Let me just... check...

#

Hang on

tawdry mulch
#

You dont have to check, there isnt, thats why the error appears

solar ether
#

There is, apparently

tawdry mulch
#

Then the code should work tbh

#

I can see that the py file is inside a folder called src, why dont you move the terminal to that location and also copy the config to that location

#

Anyway you got rid of the error about PySide6

solar ether
tawdry mulch
#

Here is a tip on how I use VSC, because file path and locations are VERY IMPORTANT or they will raise such errors. I create a project folder, then I put all the required files inside that, and I open cmd IN THAT LOCATION, then I type code ., this will open VSC in that folder. So now the terminal will also belong to that folder

solar ether
#

Ohh...

#

Makes sense.

tawdry mulch
#

How to open VSC in that folder easily? Go to the folder and Shift + Right click, open powershell, then type code .. But if you have an option called 'open with code' then just click on it, this option has to be enabled during VSC installation

solar ether
#

I got it.

tawdry mulch
#

Great

solar ether
#

Thanks man

#

File path is so sensitive. xD

tawdry mulch
solar ether
#

If you don't mind, can you explain that more in my DM?

digital rose
#

How would i go about making it such that

#

When a user re sizes window

#

the widgets also change position

#

pyQt

#

would i have to implement this in the styleSheet(css)?

sinful kelp
digital rose
#

:/

tawdry mulch
digital rose
digital rose
#

thats how it was with kivy but

#

it was sorta weird with gridLayout

sinful kelp
tawdry mulch
digital rose
#

im doing it in pyQt now hoping it will be easier

digital rose
tawdry mulch
digital rose
#

:(

#

If i resized the widget positions remain the same

#

i want them to either contrast the padding, or sorta fit into the number of rows present

#

i tried with kivy, but orientation(left-right, top-bottom) was ruining everything

#

So i decided to use pyQt

tawdry mulch
#

Hmmmm, I am not sure, I dont use these because I dont like it, too hard for me :P. I always disable resizing of my app

digital rose
#

:0

tawdry mulch
#

Modern solution πŸ˜›

digital rose
#

Well

#

i cant really do that

#

πŸ˜…

sinful kelp
#

modern problems require modern solutions

digital rose
#

Ill figuere it out

#

thanks

sinful kelp
royal rose
#

Hello, so I am creating an application where you can create photo albums and put pictures in them
but there is a problem, to locate all the albums created I list all the subfolders in the "gallery" folder and create a group of widgets with a button above and the name of the album below; for each sub-folder containing a "properties.json" file, I therefore add a new group of widgets. The command executed when clicking on a button calls the "openGallery" function and gives as parameter the name of the gallery to open. except that no matter which gallery you click, it will always open the same one and I think this problem is due to the fact that the widgets created have the same name. So there would be a way to create same widgets with differents name in a loop ?

tawdry mulch
royal rose
#

wow this work.. thanks
but what do the i=i do ?

tawdry mulch
#

Beginner mistakes, nothing serious πŸ˜„

royal rose
#

Ohhhh, thanks you ! :D

pure blaze
#

Hello - I am working with pyqt6 (using pyside6 module). It looks like we can add widgets to a UI using the QBoxLayout class or by creating the widget with the parent UI as an arg. Wondering which is better, if there might be pitfalls? I've been using the QBoxLayout class and using setLayout() so far

ivory ember
onyx spoke
#

ModuleNotFoundError: No module named 'kivy.speedmeter'
how can i fix this error??

brazen thicket
tawdry mulch
#

Python does have some good GUI libraries, what are you looking to make

#

If your looking for something simple, tkinter can do it

#

If your looking for something complex and modern, PyQt can do it

#

Well, I don't know what you mean by cross language, but Qt is originally from C++, PyQt is the python version of the C++ Qt

pearl yarrow
#

Help me please, window.mainloop() is constantly getting in the way by conflicting with other lines of code how to separate it?

pearl yarrow
#

I an example I can't provide everything is confused there

tawdry mulch
pearl yarrow
#

need some condition or something that could separate the mainloop from the main code

lime monolith
pliant dagger
regal kiln
#

can someone help?

tawdry mulch
proven basinBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

onyx spoke
#

I will create a page in pyqt5. The page will be constantly updated. that is, the data displayed on the screen will be constantly updated. how can I do that???

tawdry mulch
onyx spoke
worthy ridge
#

Thats qml

tawdry mulch
onyx spoke
tawdry mulch
trail heron
#

Is Pyqt and qtdesigner better than tkinter?

sturdy skiff
#

yes imo

worthy ridge
onyx spoke
#

Hello there. I am making a project with pyqt5. but i have a problem. The data on the screen needs to be constantly updated. How do I do this?
I am writing two functions in klass but the other one is not working?

tawdry mulch
trail heron
#

AttributeError: type object 'Ui_Form' has no attribute 'setObjectName'

Getting this error in PyQt5

Trying to change from Main window screen to a form

#

can provide code

trail heron
tawdry mulch
trail heron
#

Traceback (most recent call last):
File "d:\stuff\Work\Python\Applications\App\index.py", line 25, in loginpage
self.login = Login()
File "d:\stuff\Work\Python\Applications\App\index.py", line 14, in init
self.ui.setupUi(Ui_Form)
File "d:\stuff\Work\Python\Applications\App\login.py", line 6, in setupUi
Form.setObjectName("Form")
AttributeError: type object 'Ui_Form' has no attribute 'setObjectName'

tawdry mulch
#

!code

trail heron
#
  File "d:\stuff\Work\Python\Applications\App\index.py", line 25, in loginpage
    self.login = Login()
  File "d:\stuff\Work\Python\Applications\App\index.py", line 14, in __init__
    self.ui.setupUi(Ui_Form)
  File "d:\stuff\Work\Python\Applications\App\login.py", line 6, in setupUi
    Form.setObjectName("Form")
AttributeError: type object 'Ui_Form' has no attribute 'setObjectName'

tawdry mulch
trail heron
#

nope

tawdry mulch
# trail heron nope

I don't understand why are you passing in the same object to something that is being called from the same object?

trail heron
#

Wdym

tawdry mulch
trail heron
#

Im trying to make it so when u press a button on main it opens up the login page

#

@tawdry mulch

tawdry mulch
trail heron
#

Nothing but if i remove it the error goes down to the resize line

#

and says that has no attribute

tawdry mulch
#

Hmmm I am not sure, i'll let someone else here help

#

@ivory ember Please take a look the above issue please

sturdy skiff
#

Using PySide6, how would I be able to remove the stuff behind the QTableWidget scrollbars? the light grey background and what looks like a border

torpid cipher
#

can someone help me?

#

i am using pyqt5 and i am stuck now

torpid cipher
#

import sys
from PyQt5.QtWidgets import *

class App(QWidget):

    def __init__(self):
        super().__init__()
        self.title = 'AI'
        self.left = 100
        self.top = 100
        self.width = 640
        self.height = 480
    
    def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)
        self.openFileNameDialog()
        self.result()
        
    def openFileNameDialog(self):
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        sound, _ = QFileDialog.getOpenFileName(self,
            "QFileDialog.getOpenFileName()", "","Files(*.mp3)", options=options)
        
        if sound == "":
             cancel = QMessageBox()
             cancel.setText("\nCancel selection")
             return_value = cancel.exec()
             return
        name = QMessageBox()
        name.setText(sound)
        return_value = name.exec()


    def result(self):
       resultbox = QMessageBox()
       resultbox.setText('''this is the pump sound. ''')
       return_value = resultbox.exec()
       
if __name__ == '__main__':
    app = QApplication(sys.argv)
    button = QPushButton('Start')
    ex = App() 
    button.clicked.connect(ex.initUI)
    button.show()
    sys.exit(app.exec_())
#

here is my code, i am stuck in how to make the sound's QMessageBox do not have the path

worthy ridge
#

@torpid cipherwdum buddy

torpid cipher
#

if i open a mp3 file called "test.mp3", i want to have an output which is

#

'file : test

#

this is the pump sound'

#

like this

digital rose
near birch
#

ok

lone phoenix
proven basinBOT
#

Hey @digital rose!

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

digital rose
lone phoenix
digital rose
tawdry mulch
digital rose
#
       QWidget{
            background: #000000;
        }
        QLabel{
            color: #fff;
        }
        QLabel#round_count_label, QLabel#highscore_count_label{
            border: 1px solid #fff;
            border-radius: 8px;
            padding: 2px;
        }
        QPushButton
        {
            color : rgba(0, 0, 0, 100);
            background: rgba(100, 100, 100, 50);
            border: 1px #DADADA solid;
            padding: 5px 10px;
            border-radius: 15px;
            font-size: 110pt;
            outline: none;
        }
        QPushButton#pushButton_2
        {
            color : rgba(255, 255 255, 100);
            background: rgba(200, 200, 200, 100);
            border: 1px #DADADA solid;
            padding: 5px 10px;
            border-radius: 1px;
           font-size: 15pt;
            outline: none;
        }
        QPushButton#pushButton_3
        {
            color : rgba(255, 255 255, 100);
            background: rgba(200, 200, 200, 100);
            border: 1px #DADADA solid;
            padding: 5px 10px;
            border-radius: 1px;
           font-size: 15pt;
            outline: none;
        }
        QPushButton#pushButton_4
        {
            color : rgba(255, 255 255, 100);
            background: rgba(200, 200, 200, 100);
            border: 1px #DADADA solid;
            padding: 5px 10px;
            border-radius: 1px;
           font-size: 15pt;
            outline: none;
        }
        QPushButton:hover{
            color : rgba(0, 0, 0, 100);
            background: rgba(200, 200,200, 50);
            border: 1px #DADADA solid;
            padding: 5px 10px;
            border-radius: 15px;
            outline: none;
        }
        QPushButton#pushButton_2:hover{
            color : rgba(0, 0, 0, 100);
            background: rgba(255, 255, 255, 50);
            border: 1px #DADADA solid;
            padding: 5px 10px;
        }
        QPushButton#pushButton_3:hover{
            color : rgba(0, 0, 0, 100);
            background: rgba(255, 255, 255, 50);
            border: 1px #DADADA solid;
            padding: 5px 10px;
        }
        QPushButton#pushButton_4:hover{
            color : rgba(0, 0, 0, 100);
            background: rgba(255, 255, 255, 50);
            border: 1px #DADADA solid;
            padding: 5px 10px;
        }
        QLineEdit {
            padding: 1px;
            color: #fff;
            border-style: solid;
            border: 2px solid #fff;
            border-radius: 8px;
        }
#

its

#

CSS

#

:)

lone phoenix
tawdry mulch
#

"Qt Style Sheet terminology and syntactic rules are almost identical to those of HTML CSS. If you already know CSS, you can probably skim quickly through this section." so It is not clearly CSS but almost like CSS

lone phoenix
#

yep

#

its css-like but not really css. more complex css things like animations wont work.

digital rose
#

well

#

y'all are wrong

tawdry mulch
#

Yea like CSS animations, etc wont work

digital rose
#

google is wrong

#

lol

#

jk

#

i see

#

i didnt know that

tawdry mulch
#

I get you πŸ˜„

somber badger
#

Sorry if this is not the place to ask but i'm learning kivy and for some reason when i right click in an empty app a red dot appears. Why does it do that? Can i change it?

tame shore
#

anyone likes simple "terminal" user interface ?

ivory ember
digital rose
#

someone know how to export images (tkinter background) with pyinstaller to my exe? The users obviously dont have the images in the directory so yea how can i share a exe with images?

#

only works on my device (the pictures on my window)

tawdry mulch
digital rose
#

i have an exe

#

but it does not show the images on other devices

tawdry mulch
tame shore
#

but being a linux user i usually prefer terminal CLIs

digital rose
#

yes what has it to do with background image and logo?

ivory ember
tawdry mulch
onyx spoke
#

Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before constructing QGuiApplication.
Could not create pixmap from :/newPrefix/test.jpg
"QFormBuilder was unable to create a custom widget of the class 'QwtCompass'; defaulting to base class 'QwtDial'."
"QFormBuilder was unable to create a custom widget of the class 'QwtDial'; defaulting to base class 'QWidget'."
Could not create pixmap from :/newPrefix/test.jpg
Could not create pixmap from :/newPrefix/test.jpg

digital rose
#

so the setup creates a folder with the images inside?

onyx spoke
tawdry mulch
tawdry mulch
digital rose
#

but i would need to change the path right for the 2 images in my script right?

digital rose
#

i would need to change that to the installation path where he puts the images then right?

tawdry mulch
#

Yea, put it where your script is @digital rose and change the path accordingly

digital rose
#

ok

#

Hey, I need some help!
I am build a UI program! I want that when the button gets clicked it browses a folder and its address gets inserted in the entry field! And that same address should be temporarily save in the json file too! Once the program is closed the json entry will also be deleted!! How do I do that?

digital rose
#

so i need these 2 files and add them to the NSIS?

#

alright works

#

the setup creates now a folder now how can i make the images work again because they have no path?

#

i would like to have the EXE installed on the desktop and the image folder placed in the dokuments folder or something like that

tawdry mulch
#

The thing is you have 2 opt, 1 is to use pyinstaller and bundle it 2nd is to make an installer

digital rose
digital rose
tawdry mulch
digital rose
#

the one i used for my exe?

#
pyinstaller.exe --onefile --icon=C:/Users/Philipp/Pictures/anno.ico --windowed plop.py
#

i need to change the ico path too then

tawdry mulch
#

Use pyinstaller.exe --onedir --icon=C:/Users/Philipp/Pictures/anno.ico --windowed plop.py

digital rose
#

do my images work then?

tawdry mulch
#

Wait, make a folder and COPY ALL THE FILES YOU NEED INSIDE IT

onyx spoke
#

Could not create pixmap from :/newPrefix/test.jpg
Could not create pixmap from :/newPrefix/test.jpg

#

??

digital rose
tawdry mulch
tawdry mulch
#

Then now change path

tawdry mulch
digital rose
#

without the exe i gues

tawdry mulch
#

Forget the exe for now

digital rose
#

alright done

tawdry mulch
#

Now check if script works, try running the app

digital rose
#

no because the path for the images arent right

tawdry mulch
digital rose
#

ah kk sry

#

works

#

pyinstaller.exe --onedir --icon=C:/Users/Philipp/Pictures/anno.ico --windowed plop.py

#

so now this?

#

i need to tell pyinstaller the path of .plop

#
pyinstaller.exe --onedir --icon=C:/Users/Philipp/Pictures/anno.ico --windowed C:\Users\Philipp\PycharmProjects\TestProject\AnnoChain\plop.py
#

like this?

tawdry mulch
digital rose
#

so it created a exe now but i cant run it

tawdry mulch
#

Why

digital rose
tawdry mulch
digital rose
#

then it works

#

but its not userfriendly if they have to put the exe to the images πŸ˜„

tawdry mulch
digital rose
#

now run NSIS?

tawdry mulch
digital rose
#

zip the files?

#

wait i get inno setup

#

ok inno setup is open @tawdry mulch

#

?

tawdry mulch
digital rose
tawdry mulch
digital rose
#

okay

tawdry mulch
#

Now just fill in the information

digital rose
#

but isnt the problem now that my exe always need the pictures where it stays??

tawdry mulch
# digital rose

'Add folder...' and then choose your entire folder with the exe

digital rose
#

ahh shortcut?

tawdry mulch
#

Yes proceed

digital rose
tawdry mulch
#

Do as you wish

digital rose
#

so the installer places the folder somewhere and automaticly adds a shortcut to the desktop?

tawdry mulch
#

yes

digital rose
#

awesome

#

where can i tell the program to put the folder?

tawdry mulch
# digital rose

No this is where the installer will be saved, not where the installation will be saved

digital rose
#

can i leave this empty?

tawdry mulch
tawdry mulch
digital rose
#

dokuments?

#

oh this is for me right

#

where the installer will be taken

tawdry mulch
digital rose
tawdry mulch
#

Okay? does it work?

digital rose
#

and the logo isnt my program too

tawdry mulch
tawdry mulch
digital rose
#

its somehow not adding my exe

#

i always get this fail

#

but i want a shortcut of my exe

#

when i run the weird Anno Chain with the fire it just opens a hello message

#

what am i doing wrong

#

@tawdry mulch

tawdry mulch
tawdry mulch
digital rose
#

when i run my exe what

tawdry mulch
#

is this the exe that comes from installer?

digital rose
#

no

#

why on desktop it worked

#

now i cant even run it anymore on desktop

#

that makes no sense

tawdry mulch
#

You are doing something wrong

digital rose
#

when i run it on my script it works

#

wtf

#

why is the exe now broken

#

i even created a new one, same error

#

can you try to do this for me.. i sent you the source code in pm :

#

😦

tawdry mulch
digital rose
#

thank you πŸ™‚

red sequoia
#

Error in input file: not well-formed (invalid token): line 1, column 0

tawdry mulch
willow kindle
#

Can anyone explain tkinter styling to me?
I really don't get it, are the names set?

Like I do:

style = ttk.Style()
style.configure("BW.TLabel", foreground="black", background="white")

self.root = root

ttk.Label(self.root, text=bot.tool).grid()
ttk.Button(
    self.root,
    text="CALL",
    padding=3,
    command=partial(bot.createOrder, 12, "call"),
    style="BW.TLabel",
).grid()

And it works but switch BW.TLabel to BW.Call and it doesn't

tawdry mulch
willow kindle
#

And what if I need to style more than 1 button?

tawdry mulch
willow kindle
#

Like, I need a button to be Green and the other one red

tawdry mulch
willow kindle
#

My html/css brain doesn't like set names like this lol

#

But thanks

#

I'll give it a try

tawdry mulch
willow kindle
#

Might be because I'm used to the "class" flexibility in that regard

tawdry mulch
willow kindle
#

Will do, thanks

lime monolith
# willow kindle Can anyone explain tkinter styling to me? I really don't get it, are the names ...

Style Names
Every style has a name. If you're going to modify a style, create a new one, or use a style for a widget, you need to know its name.

How do you know what the names of the styles are? If you have a particular widget, and you want to know what style it is currently using, you can first check the value of its style configuration option. If that is empty, it means the widget is using the default style for the widget. You can retrieve that via the widget's class. For example:

>>> b = ttk.Button()
>>> b['style']
''
>>> b.winfo_class()
'TButton'```
> In this case, the style that is being used is TButton. The default styles for other themed widgets are named similarly, e.g., TEntry, TLabel, etc.
> Beyond the default styles, though, styles can be named pretty much anything. You might create your own style (or use a theme that has a style) named FunButton, NuclearReactorButton, or even GuessWhatIAm (not a smart choice).
> 
> More often, you'll find names like Fun.TButton or NuclearReactor.TButton, which suggest variations of a base style; as you'll see, this is something Tk supports for creating and modifying styles.
Above taken from https://tkdocs.com/tutorial/styles.html
buoyant fulcrum
#

Hi, Could I get some quick assistance without making a ticket?

I am using tkinter and have made a tk.toplevel. But at the moment I can spam the button and make endless windows... how do I make it check first to see if one is already open?
The stuff I have tried has not worked

        def softwareversion():
            def close():
                root.destroy()
            root = tk.Toplevel(self)
            root.title("Software Version")
            label2 = ttk.Label(root, text="You are running xyz version 1.8.9 BETA", font=Information_Font,) #background="red")
            label2.pack(pady=0,padx=50)
            no = tk.Button(root, text = "Close", width = "8", command = close)
            no.pack(pady=4,padx=50)
tawdry mulch
buoyant fulcrum
#

Sorry I'm not sure what that is

#

I'm new to coding, somewhat anyway

tawdry mulch
#

Okay, I think that answer is terrible, perhaps you need to use flags. I do not have python now, but let me see if I can build up an example

buoyant fulcrum
#

I got that answer to work, but it just stops everything else :/

#

I'll google flags

#

Ty for helping me

tawdry mulch
# buoyant fulcrum I'll google flags
from tkinter import *

root = Tk() 
new = None # Pre define the variable first

def opener():
    global new 
    
    if new is None: # Check if the window is None like said before
        new = Toplevel() # Then make a window
        # All your other code related to the window below.....
        
    else:
        new.protocol('WM_DELETE_WINDOW',close) # What should be done if window is closed

def close():
    global new
    new.destroy() # Close the window
    new = None # Make it back to None so the if statement can be triggered again
    
Button(root,text='Open new',command=opener).pack()

root.mainloop()
#

This cannot be exactly called as flag, but this is one way of doing things

buoyant fulcrum
#

hmn ok

tawdry mulch
# buoyant fulcrum I'll google flags

Okay this is using flags:

from tkinter import *

root   = Tk() 
opened = False # Define a flag to check if the window is opened

def opener():
    global new, opened 

    if not opened: # If window is not opened
        new = Toplevel() # Open 
        new.protocol('WM_DELETE_WINDOW',close) # Call close() if window is closed
        opened = True # Now since it is opened, make it True
        # All your other code below...

def close():
    global new, opened
    
    new.destroy() # Close the window
    opened = False # Since the window is now closed, make it back to True
    
Button(root,text='Open new',command=opener).pack()

root.mainloop()
lime monolith
# buoyant fulcrum Hi, Could I get some quick assistance without making a ticket? I am using tkint...

Maybe something like this

import tkinter as tk
from tkinter import ttk


class TkApp(tk.Tk):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.entry = tk.Entry(self)
        self.entry.pack(padx=5, pady=5)
        self.button = tk.Button(self, text='Print', command=self.on_button)
        self.button.pack(pady=5)
        self.software_version_frame = None

    def on_button(self):
        try:
            self.software_version_frame.tkraise()
        except (AttributeError, tk.TclError):
            self.software_version_frame = SoftwareVersionFrame(self)


class SoftwareVersionFrame(tk.Toplevel):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.title("Software Version")
        label2 = ttk.Label(
            self, text="You are running xyz version 1.8.9 BETA", )
        label2.pack(pady=0, padx=50)
        btn = tk.Button(self, text="Close", width="8", command=self.destroy)
        btn.pack(pady=4, padx=50)


if __name__ == '__main__':
    app = TkApp()
    app.mainloop()```
buoyant fulcrum
#

Is it the classes which makes it work?

#

I have already used self and classes for the different frames in my program 😦

lime monolith
#

Classes organise the code together.
its this part that is only creating a new frame if one does not exist

        self.software_version_frame = None

    def on_button(self):
        try:
            self.software_version_frame.tkraise()
        except (AttributeError, tk.TclError):
            self.software_version_frame = SoftwareVersionFrame(self)```
buoyant fulcrum
#

It would have to be a seperate window not a frame 😦

lime monolith
# buoyant fulcrum

it is a separate window is a tk.Toplevel

class SoftwareVersionFrame(tk.Toplevel):```
tawdry mulch
buoyant fulcrum
#

Guys

#

guys

#
import tkinter as tk

win = tk.Tk()

button1 = tk.Button(win, text = "Hi")
button1.pack()

if win.winfo_exists() !=None:
   print("the window is open")
   
else:
    print("The window does not exist")
   

tk.mainloop()
#

rip that doesn't work either 😦

tawdry mulch
tawdry mulch
lime monolith
buoyant fulcrum
#

I got marked down before for using global variables

#

It's for a uni assignment

tawdry mulch
buoyant fulcrum
#

I'm using Self in mine

lime monolith
#

we're not suppose to do your homework

buoyant fulcrum
#

I understand

#

I shall leave you both in peace

#

Thank you so much for helping me

tawdry mulch
buoyant fulcrum
#

ok

#

ty

split coyote
#

I'm unable to create a button using the tkinter module, can somebody send me an example of the code
i've seen many, but they aren't working
i've also imported the correct modules

#

im new btw

#

pls help

#

im new

#

I've been wondering for ages

#

Also if you know a better module than tkinter please tell me

split coyote
#

I also installed another module, it keeps on telling me there is no such module when i import it. The module is in the correct folder though

#

what could be the issue

#

?

worthy ridge
#

please send the error log

#

and use Pyside6 as it is a new release and also backward compatable

#

@split coyote

split coyote
worthy ridge
#

do a pip freeze

#

and check if u have vlc

split coyote
#

Yes it says vlc

#

in the list

worthy ridge
#

then u shoul check ur interpreter that u use to run code

split coyote
#

im new and don't know what that is

worthy ridge
#

what IDE ur using

split coyote
#

i think it's IDLE Shell

worthy ridge
#

ohh u need to run it using the interpreter that has vlc

split coyote
#

ok

#

thank you

#

sorry im asking too much but do you know any interpreters that have vlc?

worthy ridge
#

its a module lol u install it

split coyote
#

im so confused rn lmao I installed vlc is that what u mean?

worthy ridge
#

no look up on google python package installuing

split coyote
#

ok

worthy ridge
#

u will understand whats the difference

split coyote
#

ok thx

#

ok so basically u install packages with pip in cmd right?

#

actually nvm thx for the help

#

i think i know what to do

#

whenever i finish with an error another appears lol

#

It highlights the bracket after the appostrophe following the path of a file, what should i do?

#

im sorry im asking too much but pls help

#

nevermind got it all fixed!

tawdry mulch
#

If you are a beginner, PyQt wont be easy yo follow, start with tkinter.

tawdry mulch
digital rose
#

Hey

#
QWidget{
    background: rgb(2,0,36);
    background: linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(110,5,139,1) 76%, rgba(0,212,255,1) 100%);
}
QPushButton{
    background: rgba(100, 100, 100, 0);
}

Why wont this work, pyQt: QSS

ThinkButCooler

#

im tryna make a gradient background

#

:(

worthy ridge
#

What u trynna do

digital rose
#

Is there anyway to make tabs in Qt without layouts?

onyx spoke
#

hi

#

Could not create pixmap from :/newPrefix/background.jpg

#

what is the reason for this error

split coyote
#

is it possible to make 2 things happen at once? For example, a stream of numbers is running, increasing by one each time and you click a button which makes a noise. This would cause the numbers to stop increasing by 1 until the noise ends. Is there a way to keep the stream running while the sound is being played?

#

I'm using ursina module, i want a sound to play when a box is destroyed, but the entire thing freezes in order to play that noise

#

pls answer when you see this message

digital rose
lime monolith
torpid cipher
#

hello, everyone. I want to know that if i want to make a good layout like "photo , button, version"

#

is it possible?

#
    def initUI(self):
        layout = QVBoxLayout()
        
        self.setWindowTitle('Title')
        
        self.logo=QLabel('logo') 
        pname = QPixmap('icon.png')
        self.logo.setPixmap(pname)
        layout.addWidget(self.logo)
        
        self.startbutton = QPushButton('Start')
        self.startbutton.clicked.connect(self.openFileNameDialog)
        layout.addWidget(self.startbutton)
#

I cannot show anything in this page

#

btw, i am using pyqt5

#

Please help. TT

plush stream
#
    def initUI(self):
        layout = QVBoxLayout(self)
        
        self.setWindowTitle('Title')
        
        self.logo=QLabel('logo', self) 
        pname = QPixmap('icon.png', self)
        self.logo.setPixmap(pname)
        layout.addWidget(self.logo)
        
        self.startbutton = QPushButton('Start', self)
        self.startbutton.clicked.connect(self.openFileNameDialog)
        layout.addWidget(self.startbutton)β€Š```
digital rose
#

does anyone know how to make the title bar background transparent? pyQT

#

I want that whitish part at the top to be transparent

proven basinBOT
#

main/main.py line 15

self.setWindowFlag(QtCore.Qt.FramelessWindowHint)```
digital rose
tawdry mulch
digital rose
#

Well

#

i tryna say

#

i want something like this

digital rose
tawdry mulch
digital rose
#

@tawdry mulch the red part is what i dont want, the green part is what i want

tawdry mulch
digital rose
#

what happens when you run that is, it completely removes the title bar

#

which means you cant resize

#

use min/max/full buttons

#

or change the position of the window

#

which is pointless

#

it just becomes a picture stuck to your screen then

#

anyways i tried that method

#

and came up with this

#

the ones at the right corner are the min max and full buttons

#

you can change the position of the window as well

#

but

#

it took a LOT of implementation

#
class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowMinimizeButtonHint)
        self.resize(800, 600)
        AllWidget = QWidget()
        # AllWidget.setStyleSheet("background-color:red")
        Alllayout = QVBoxLayout()
        Alllayout.setSpacing(0)
        Alllayout.setContentsMargins(0, 0, 0, 0)
        AllWidget.setLayout(Alllayout)
        self.title = TitleWidget()
        self.title.setFixedWidth(self.width())
        self.title.setFixedHeight(TITLE_HEIGHT)
        self.title.ButtonMin.clicked.connect(self.ButtonMinSlot)
        self.title.ButtonMax.clicked.connect(self.ButtonMaxSlot)
        self.title.ButtonRestore.clicked.connect(self.ButtonRestoreSlot)
        self.title.ButtonClose.clicked.connect(self.ButtonCloseSlot)
        centerWidget = QWidget()
        # centerWidget can add any control you want to use
        # centerWidget.setStyleSheet("background-color:red")
        Qss = '''
            QMainWindow{
                background:qlineargradient(spread:pad,x1:1,y1:0,x2:0,y2:1,stop:0 rgba(51,146,255,255),stop:1 rgba(255,255,255,255));  

            }
        '''

        Alllayout.addWidget(self.title)
        Alllayout.addWidget(centerWidget)
        self.setCentralWidget(AllWidget)
        self.setStyleSheet(Qss)

    def ButtonMinSlot(self):
        self.showMinimized()

    def ButtonMaxSlot(self):
        self.title.ButtonMax.setVisible(False)
        self.title.ButtonRestore.setVisible(True)
        self.title.saveRestoreInfo(self.pos(), QSize(self.width(), self.height()))
        desktopRect = QApplication.desktop().availableGeometry()
        FactRect = QRect(desktopRect.x() - 3, desktopRect.y() - 3, desktopRect.width() + 6, desktopRect.height() + 6)
        print(FactRect)
        self.setGeometry(FactRect)
        self.setFixedSize(desktopRect.width() + 6, desktopRect.height() + 6)

    def ButtonRestoreSlot(self):
        self.title.ButtonMax.setVisible(True)
        self.title.ButtonRestore.setVisible(False)
        windowPos, windowSize = self.title.getRestoreInfo()
        # print(windowPos,windowSize.width(),windowSize.height())
        self.setGeometry(windowPos.x(), windowPos.y(), windowSize.width(), windowSize.height())
        self.setFixedSize(windowSize.width(), windowSize.height())

    def ButtonCloseSlot(self):
        self.close()

    def paintEvent(self, event):
        self.title.setFixedWidth(self.width())

    def mousePressEvent(self, event):
        if event.button()==Qt.LeftButton:
            self.m_flag=True
            self.m_Position=event.globalPos()-self.pos() #Get the position of the mouse relative to the window
            event.accept()
            self.setCursor(QCursor(Qt.OpenHandCursor)) #Change the mouse icon
            
    def mouseMoveEvent(self, QMouseEvent):
        if Qt.LeftButton and self.m_flag:  
            self.move(QMouseEvent.globalPos()-self.m_Position)#Change window position
            QMouseEvent.accept()
            
    def mouseReleaseEvent(self, QMouseEvent):
        self.m_flag=False
        self.setCursor(QCursor(Qt.ArrowCursor))
#

this is half of it

#

and its just not very worth it

#

so i was thinking of a way to just make the title bar background transparent

tawdry mulch
#

It is how people do it, you remove the title bar and put your own drag, resize bla bla functions

digital rose
#

Hey,
I have used tkinter library in python
I want the function associated with each individual checkbox to be executed only when its checked and when i click the start button!! how do i do it? please help

lime monolith
lime monolith
digital rose
vague hearth
#

I'm writing a gui which has a plot which should refresh at 30fps. The way I'm doing it is that a thread emits "refresh" signals at 30fps, which update the gui in the main loop, but this is freezing the gui because the main loop is swamped. Is there a way to fix this?

#

Ok, I think I've found a solution to the issue: Instead of using a thread, I'll use a timer which calls the refresh method at 30fps... seems to work

vague hearth
#

Can anyone explain why these two threads are not working at the same time?

#
import sys
import time

from PyQt5 import QtWidgets
from PyQt5.QtCore import QObject, QThread, pyqtSignal


class Worker(QObject):
    def run(self, str):
        while True:
            print(str)


class ThreadController():
    def __init__(self):
        # Thread 1
        self.thread = QThread()
        self.worker = Worker()
        self.worker.moveToThread(self.thread)
        self.thread.started.connect(lambda:self.worker.run('worker1'))
        self.thread.start()

        # Thread 2
        self.thread2 = QThread()
        self.worker2 = Worker()
        self.worker2.moveToThread(self.thread2)
        self.thread2.started.connect(lambda:self.worker2.run('worker2'))
        self.thread2.start()


if __name__=='__main__':
    app = QtWidgets.QApplication(sys.argv)
    thread = ThreadController()
    sys.exit(app.exec_())
#

The output is just "worker1"

ivory ember
vague hearth
#

Ok, I could do that. But is there a way to fix the above code using QThread?

#

Also, I don't understand why the above doesn't work in the first place.

solar nest
#

I got a weird question

#

Has anyone here used the property decorator to tell a class to return pysimplegui controls rather than just the flat value when accessed by a rendered application?

#

And if so, have you tried to pin down the memory cost of doing such a thing? I did a thing and I dont know if its like, so stupid that people know not to do it or if just everyone doing it is charging for it or what

#

That sort of thing

#

Teaching myself databinding in python so confidence is not unshakeabke, but I like how the code looks

#

The self.render bit is a placeholder for what will be the signature of the container making the request which will give the class its various formatting data, so that things running without a gui dont ideally need to carry the extra baggage and it saves me the time of writing things around the class rather than into

#

there are obvious datatype concerns since the same property can return various types, but in practice that wasnt too bad and if the signature thing I said earlier works half as good as my imagination I dont see major issues

solar nest
#

the example is from an odbc assembler that is the entry to the actual application, so the properties and classes are the simplified version and can share the whole class if needed

torpid cipher
plush stream
#

With the above method, the move event of the window will be handled by the os.

ivory ember
plush stream
ivory ember
#

shoot, can u dm me an invite

plush stream
#

Sure

sturdy skiff
plush stream
#

Alr

digital rose
#

let me try that

#

yeah so

#

that works

#

but

#

i still cant resize

plush stream
#

You could use QSizeGrip

digital rose
#

like how u did for the func

#

rn i tried this

plush stream
#

Alright gimme a sec

digital rose
#
    def mousePressEvent(self, e):
        self.window().windowHandle().startSystemMove()
        self.window().windowHandle().startSystemResize(self, Union[Qt.Edges, Qt.Edge])
#

but Union isnt defined ig

#

πŸ˜…

plush stream
#
class BaseWindow(QtWidgets.QWidget):
    def __init__(self):
        super(BaseWindow, self).__init__()
        self.sizegrip = QtWidgets.QSizeGrip(self)

    def resizeEvent(self, event) -> None:
        self.sizegrip.move(self.width() - 15, self.height() - 15) # keep the qsizegrip at the bottom right corner when resizing
digital rose
#

:0

#

one sec let me try that

plush stream
#

that's roughly the code. it could still be improved by using layout instead of manually updating the qsizegrip position per resize event.

digital rose
#

so

#

i added it at the end

#

but

#

it doesnt work

#

it doesnt throw any errors

#

but it doesnt work

plush stream
#

bear in mind that you can only resize from one point, which is the bottom right corner

#

if you want to resize from all direction, then you have to implement qsizegrip for every direction

digital rose
#

didnt work 😦

#

can u try running that code

#

and see

plush stream
#

you put qsizegrip in the class BaseWindow but you initialize the MainWindow class instead

#

that's why it doesn't work

digital rose
#

oh

#

welp

#

anyways

#

ill just work with that border thing

#

its fine

#

ill figuere itout

#

thanks!

zinc flume
#

hello

tawdry mulch
digital rose
zinc flume
#

I am new competitor

#

I hopefully get new knowledge from friends, thanks a lot

frank sinew
#

Why not?

lofty pond
frank sinew
# lofty pond That looks great!

Thanks! I'm trying to copy all uwp design, I've already published the window blur on pypi with the name 'BlurWindow', when I have more widgets I'll publish this one too

#

BlurWindow works with pyside,pyqt,etc too

frank sinew
#

my question actually is, will anyone use? I'll make new widgets too, like a table for displaying sqlite results or a dict

frank sinew
tawdry mulch
tawdry mulch
frank sinew
tawdry mulch
#

That can be used with tkinter?

frank sinew
#

Ye

frank sinew
worthy ridge
tawdry mulch
#

Just a min, let me test it out

frank sinew
#

Warning: Just work in windows

proven basinBOT
#

Examples%20MUST%20SEE/tkinter%20BLUR.py line 12

global HWND```
frank sinew
#

Only in windows and mac it is possible to make a transparent window in tkinter

tawdry mulch
frank sinew
#

Ctrl c ctrl v lol

tawdry mulch
#

Lol

frank sinew
#

Worked? You are the first to test it lol

tawdry mulch
#

It does work, but while dragging windows, it lags the drag

frank sinew
#

Yes, is a Windows bug

#

But

tawdry mulch
#

on the applyacrylic the lag is just so much, but the other seems to be compensable.

frank sinew
plush stream
#

Windows 10 has acrylic blur lag due to mouse polling issue. But it seems to be fixed in Windows 11

tawdry mulch
plush stream
#

Very similar to mine. But mine only target PySide/PyQt πŸ˜„

frank sinew
#

But I want to add Mac support too

frank sinew
tawdry mulch
plush stream
#

Release it to where? Pypi?

tawdry mulch
#

Jus joking, I mean figured it out

plush stream
#

Oh lmao

frank sinew
plush stream
#

Haha it's the only janky way to fix it

tawdry mulch
#

If windows 11 fixes it, its great, I can finally start modernizing tkinter.

frank sinew
tawdry mulch
plush stream
torpid cipher
# plush stream ```py def initUI(self): layout = QVBoxLayout(self) ...
 def initUI(self):
        layout = QVBoxLayout(self)
        
        self.setWindowTitle('title')
        self.resize(450,350)
        
        photo=QLabel(self) 
        photo.setGeometry(20, 0, 411, 100)
        photo.setPixmap(QPixmap('logo.png'))  
        
        self.startbutton = QPushButton('Start',self)
        self.startbutton.clicked.connect(self.openFileNameDialog)
        #self.startbutton.resize(100,50)
        #self.startbutton.move(0,150)
        layout.addWidget(self.startbutton)

        self.version = QLabel('''

Version 0.13.b
                              ''')
        self.version.setAlignment(QtCore.Qt.AlignRight)                     
        layout.addWidget(self.version)
#

i am adding more thing in the code

#

however, i found out that the move is not working

#

the start button and the logo and the word(version) is overlap

#

i want the layout is the top part is just logo, second in start button and the bottom is the version

plush stream
#

You haven't added the start button to the layout

#

Can ya send me a screenshot

frank sinew
torpid cipher
#

the screenshot is this @plush stream

plush stream
#

Hold a sec i'll fire up my pc

torpid cipher
# torpid cipher

i want the soundwave picture is just the photo, not the background

#

omg , i fix the bug

#

XDDDD

#

i miss to addWidget in the photo part

plush stream
#

aw heck good eye

#

didn't notice that too

torpid cipher
#

however, I am facing another problem. TT.

#

I want to select a file and then show the file name of the file in different def.

#

i cannot bring the thing out / show the file name only (not the path)

tawdry mulch
torpid cipher
#
def openFileNameDialog(self):
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        soundfile, _ = QFileDialog.getOpenFileName(self,"Open File", "","Voice Files (*.wav)", options=options)
        if soundfile == "":
             cancel = QMessageBox()
             cancel.setText("\nCancel selection")
             return_value = cancel.exec()
             return
        else: 
             name = QMessageBox()
             name.setText(soundfile)
             return_value = name.exec()
             self.output()
             
    def output(self):
        result = QMessageBox()
        result.setText(β€˜heading. ')
        result.setInformativeText(β€˜word’)
        return_value = result.exec()
torpid cipher
#

i want to print sth like this. the ____ is a variable that in different def.

plush stream
wanton sorrel
#

hey guys! Any suggestions to make design of this calculator better ?

torpid cipher
#

i can print the 'c:/downloads/test.wav'

plush stream
torpid cipher
tawdry mulch
frank sinew
torpid cipher
wanton sorrel
tawdry mulch
torpid cipher
#

i want to print the 'soundfile'

plush stream
#

CoolCloud's solution is simpler but this also works:


import os

path = "C:/Users/JohnDoe/hello world.txt"
converted = os.path.split(os.path.splitext(path)[0])[1]
print(converted)
tawdry mulch
# torpid cipher i want to print the 'soundfile'
import os
def openFileNameDialog(self):
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        soundfile, _ = QFileDialog.getOpenFileName(self,"Open File", "","Voice Files (*.wav)", options=options)
        if soundfile == "":
             cancel = QMessageBox()
             cancel.setText("\nCancel selection")
             return_value = cancel.exec()
             return
        else: 
             name = QMessageBox()
             self.file = os.path.basename(soundfile).split('.')[0] # SHOW THE FILE IN THE MESSAGEBOX
             name.setText(self.file)
             return_value = name.exec()
             self.output()
             
    def output(self):
        result = QMessageBox()
        result.setText(β€˜heading. ')
        result.setInformativeText(β€˜word’)
        return_value = result.exec()
torpid cipher
#

NameError: name 'soundfile' is not defined

#

it works.

#

!!

#

i forgot to put all 'self. '

#

for the output def. , can i use QVBoxLayout / Nesting Layout ? if then, can i make the same thing like the initUI ?

digital rose
#

obviously wrong

torpid cipher
plush stream
#

or if you want to center the whole layout:
layout.setAlignment(QtCore.Qt.AlignCenter)

torpid cipher
latent pawn
#

i am creating a gui from base level. how can i render screen properly by taking input, showing animations, all at the same time?

plush stream
#

What do you mean exactly by "base level"? Are you creating gui from scratch?

latent pawn
#

yeah

#

just give me the idea, how to get input,show animations, and render the screen all at the same time? should i thread the rendering process, input process and animations?

#

how should i setup the system of these?

plush stream
#

dunno much abt creating gui from scratch but concurrency should be a good way to do many things at once so yeah. i guess threads would work

latent pawn
#

ok then, thanks

analog elbow
#

Hi people. Hope you're all doing great
I don't know whether this is the right channel to seek code feedback or not. If not please redirect me to the right chnnel.
I' ve built a simple music player with Tkinter and pygame. Could you please review my code. I am open to all levels of criticism 🧐 .
Repo : https://github.com/omazdev/simple-music-player

GitHub

Desktop Music Player built in Python using Tkinter - omazdev/simple-music-player

torpid cipher
#

I am sorry to ask question again. But how can I have two Layout in the code but in different def. ? because i am making the result thing, and i cannot make the layout of result appear. It can change the icon and the title only.

tawdry mulch
analog bison
#

Having some trouble getting a basic UI to update a QMainWindow from a QThread using signals/slots. Anyone free to help?

sullen thunder
#

Hey all, sorry if this has been discussed before. I have gotten into a discussion with someone on a different coding board about the use of lamda in a PyQt program.

He was not a fan, saying it was a bad practice. I couldn't find a work around for my use case. Depicted below.

(Action = is a menu button from a QMainWindow class.)

self.ui.action.triggered.connect(lambda: self.some_function('arguement'))
self.ui.action.triggered.connect(lambda: self.some_function('differentArguement'))

Thoughts? Without the need to seperate the above function into two seperate functions.

sullen thunder
# tawdry mulch How else does he suggest

So he hasn't actually made a suggestion on how to fix the issue. He was trying to explain something with a dictionary, but it always fell back to the same problem.

sullen thunder
#

Though, wouldn't that require you to essentially make a variable for each possible argument?

lime monolith
sullen thunder
#

Okay, that is an interesting approach. I am curious if that would work. Though I fear it would run into the same issue. As it appears PyQt prefers

self.ui.action.triggered.connect(self.some_function)

Everything else appears to fail.

lime monolith
#

hmm they the same event

sullen thunder
lime monolith
#

if they the same event do two things

    self.ui.action.triggered.connect(self.helper_func)
    self.ui.action.triggered.connect(self.helper_func)

def helper_func(self):
    self.some_function('arguement')
    self.some_function('differentArguement')```
tawdry mulch
sullen thunder
tawdry mulch
keen bronze
young sedge
abstract adder
#

What does this error mean:
||TypeError: arguments did not match any overloaded call:
addWidget(self, QWidget): argument 1 has unexpected type 'int'
addWidget(self, QWidget, int, int, alignment: Union[Qt.Alignment, Qt.AlignmentFlag] = Qt.Alignment()): argument 1 has unexpected type 'int'
addWidget(self, QWidget, int, int, int, int, alignment: Union[Qt.Alignment, Qt.AlignmentFlag] = Qt.Alignment()): argument 1 has unexpected type 'int'||

in the line:
lay.addWidget(tab.addTab(QWidget(), str('Tab')),1,0)

onyx spoke
#

Can someone using pyqt5 help me

north ore
#

Any kivy expert here?

rain jetty
#

i am using pyqt5

rain jetty
#

what is tab?

digital rose
#

anything to change? it just feels like somethings off and missing

young sedge
#

Looks cool

digital rose
#

PyQt5

digital rose
#

The hard coding part is fairly difficult whereas the basic gui design can be done with qt designer and/or creator. which is basically an ide for guis

abstract adder
young sedge
#

550 dollars per dev

sudden coral
#

I believe they dual license it with some commercial license and GPL.

#

GPL absolutely allows for commercial usage, but you have to keep it open source. If you don't want to open source your product, then you need the commercial license instead. Though that may not be the only reason for using the commercial license. I never bothered to read it.

#

Pyside on the other hand is licensed under LGPL. I don't think I'd be able to explain the differences between GPL and LGPL well, so that's for you to research.

split coyote
#

Can someone help

#

I have an issue, i cannot use modules unless i take them to the same directory/folder as the python file, is there a way to fix that? Because otherwise it would say "No module named..."

onyx spoke
#

ModuleNotFoundError: No module named 'qwt_dial'

#

what is the reason for this error?

split coyote
#

"Syntax Error: Unicode error, can't decode bytes in position
" what could the reason for this error be? here's my code : `import time
import tkinter
import flask
from flask import Flask
from flask import request, jsonify
import flask

app = flask.Flask(name)

app.config["DEBUG"] = False

@app.route('/')
def home():
return "<h1>my 1st api!!!</h1><p> my 1st api</p><img src>'C:\Users\rorop\Desktop\1stAPI\IMG.jpg'</src>"

app.run(host='0.0.0.0')`

#

the error is somewhere in "<img src>'C:\Users\rorop\Desktop\1stAPI\IMG.jpg'</src>"

bleak silo
#

Is there any good video or book recommendation for qt creator with Python? (Pls ping me)

tawdry mulch
noble star
#

Hey, how can I go from an interface to another by a call

#

Let me explain more:

File 1 ----> Gui1
File 2 ----> Gui2

Method_in_file1():
  This method will call the file2 to show the GUI2 

----------All this with tkinter -----------
digital rose
#

Updated it and connected the windows, the fun has begun Neko

tawdry mulch
tawdry mulch
noble star
#

You didn't understand ! πŸ™‚

#

I code each Gui on a class, wich I put on a file

noble star
digital rose
#

PyQt5

noble star
#

nice

#

@tawdry mulch I did but ... there a issue

tawdry mulch
noble star
#

I got this

#

But I'm supposed to get this

#

A lot of difference

tawdry mulch
icy flower
#

how is this signup page please suggest me improvement

rough isle
#

Colors look good, I would add a little more whitespace between the form and the image and add some whitespace between Password and First Name to make the form easier to read.

#

You have quite a lot of free space on the sides so I would make use of that. Also, in my opinion you don't need another logo inside the form, which will give you a bit more vertical space to work with.

rough isle
#

In terms of color and contrast it looks good, but maybe you could make the "Sign up..." text a bit darker.

tawdry mulch
rough isle
#

Depends on your main colors of course

vital hazel
#

Hello! Im trying to get a python GUI framework that's like electron but doesn't use a bzillion resources for nothing. I've tried countless but some were weird or too restrictive, others were just not documented at all... I've seen eel is a good option, I discarded it because I couldn't find how to eliminate the window frame (so I could make my own) but maybe I missed it. Is there a way to make eel remove the window frame?

#

This one

#

Basically make a borderless window

icy flower
vital hazel
#

For example yes

#

Discord itself is also an example

icy flower
#

i use web appπŸ˜…

digital rose
#

Is there anyway to make custom widgets from UI that I make?

#

In pyqt5

icy flower
tawdry mulch
vital hazel
#

Yeah but I hated those, Im looking for an HTML/CSS framework

#

I think I'll end up using neutralinojs and do it in javascript instead

vital hazel
#

Yeah

#

eel and flaskwebgui were good options, the only thing is the borderless window problem

tawdry mulch
vital hazel
#

Maybe I should just not base my language option because of a borderless feature tbh

#

You know what I'll just go with flaskwebgui

#

Im quite used to flask and jinja

tawdry mulch
vital hazel
#

Thanks

digital rose
digital rose
# digital rose

just found out the creator of a popular point of sale program has sold it for 350-million two months ago; i got work to do

icy flower
icy flower
#

Sorry it's is html CSS Page I am building web application with Django

spring turtle
#

i have 2 question of tkinter

#
  1. how can i give a height to tk.Entry object
tawdry mulch
spring turtle
tawdry mulch
spring turtle
#

i can take input from that?

tawdry mulch
#

Sure

spring turtle
#

oh , thanks

#

i have another question,

#

2)how can i trigger a function or some piece of code whenever a new letter is added in the Text widget by user

tawdry mulch
#

bind it to <Key>

spring turtle
#

bind the function to a specific key?

tawdry mulch
#

Not a specific key, <KeyRelease> means all keys

spring turtle
#

it only applies to a single Text object?

tawdry mulch
spring turtle
#

cool

#

Thanks

tawdry mulch
spring turtle
#

i searched how to bind key on google and it show the same result

#

lol

tawdry mulch
#

yup same thing

spring turtle
#

Textbox.get() doesn't return latest character

#

for eg if i have written "qwerty" it will only return "qwert"

tawdry mulch
spring turtle
#

am doing get(0.0,'end')

#

i can add the last letter myself as it gives it to me as an argument in the function, but i don't understand the cause of the problem

tawdry mulch
spring turtle
#

same issue

#

still

tawdry mulch
#

Binding to <Key> would cause a delay

spring turtle
#

i bind it to '<Key>'

#

my bad

tawdry mulch
#

Yup....that simple

spring turtle
#

sorry for disturbing you

tawdry mulch
#

I am here for tkinter, all you need πŸ˜‚

spring turtle
#

hehe thanks

lime monolith
# spring turtle 2)how can i trigger a function or some piece of code whenever a new letter is ad...

If you are interested it getting just the last letter you can bind to the <key> event and get the key from event.char

import tkinter as tk


class TkApp(tk.Tk):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.txt = tk.Text(self)
        self.txt.pack(padx=5, pady=5)
        self.txt.bind('<Key>', self.on_txt_key)

    def on_txt_key(self, event):
        print(event.char)


if __name__ == '__main__':
    app = TkApp()
    app.mainloop()```
spring turtle
warm rampart
#

so i am working on a UI on raspberry pi 4 and it included changing pages so i am using classes to create and change pages.
my question is how do i change the size of the frame in a frame class and how can i use .place function to place widgets in it ?

warm rampart
#

i wanted to change the background color of frame and its size

#

and also use .place function to place widgets in it

tawdry mulch
warm rampart
#

how do i paste code in here ?

tawdry mulch
#

!code

proven basinBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

warm rampart
#
class page_run(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent, bg = "white")
        self.parent = parent
        self.parent.geomerty("500x500")

this code is not changing color or size of the frame

tawdry mulch
#

because the frame has to be big

warm rampart
#

big how ?
i have defined the main window geometry to be 610x976 and is set to not-resizable

#

it still doesnt work if i set the frame size equal to the main window size

tawdry mulch
#

Can you give your entire code?

warm rampart
#
import tkinter as tk

class MainWindow(tk.Tk):
    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)
        self.title("hello")
        self.geometry("610x976")
        
        container = tk.Frame(self)
        container.place(x=0, y=0)
        self.frames = {}
        
        for F in (page_run, page_program):
            frame = F(container, self)
            self.frames[F] = frame
            frame.grid(row=0, column=0, sticky="nsew")
            
        self.show_frame(page_run)
        
    def show_frame(self, name):
        frame = self.frames[name]
        frame.tkraise()
            
class page_run(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent, bg = "white")
        self.parent = parent
        self.parent.geomerty("500x500")
        
        label = tk.Label(self, text = "page run\n\n\n\n", fg = "red", bg = "white", font = ("veranda", 20, "bold"))
        label.grid(column = 0, row = 0, sticky = "nsew")
            
        button1 = tk.Button(self, text="Visit Page program", command=lambda : controller.show_frame(page_program))
        button1.grid(column = 1, row = 1, sticky="nsew")
        
class page_program(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        label = tk.Label(self, text = "page program", font = ("veranda", 12, "bold"))
        label.pack()
            
        button1 = tk.Button(self, text="Visit Page run", command=lambda : controller.show_frame(page_run))
        button1.pack()
    
if __name__ == '__main__':
    app = MainWindow()
    app.mainloop()
hoary pine
#

how do i remove this

tawdry mulch
hoary pine
tawdry mulch
tawdry mulch
warm rampart
#

https://loctv.wordpress.com/2016/09/28/python-tkinter-multiple-windowsframes/
i modified this refrence code to suit my needs and everything works. i just wanna know how can i implement frame command like background colors, frame size, .place function etc.
@tawdry mulch

To be able to understand the code in this example, I assume you guys have basic Python skill, no need to know about tkinter module, because everything will be explained detailedly. The idea of this…

#

thanks for your help

noble star
#

@tawdry mulch
Here is the code

class home(tk.Tk):

    def __init__(self):
        tk.Tk.__init__(self)
        self. filename = ''
        self.create_widgets()
    def create_widgets():
      pass

    def analyze(self):
        if(self.filename != ''):
            analyzer(self.filename).main()
            results()

        else:
            pass
if __name__ == "__main__":
    win = home()
    win.resizable(False, False)
    win.title("Sperm analyzer version 0.1")
    win.mainloop()

|-----------------------------|

The seconde class code
class results(Tk):

    def __init__(self):
        Tk.__init__(self)
        self.widgets_creator()

    def widgets_creator():
      pass


if __name__ == '__main__':
    win2 = results()
    win2.resizable(False, False)
    win2.title("Sperm analyzer version 0.1")
    win2.geometry("1024x768")
    win2.mainloop()
noble star
#

I didn't shared the widgets

warm rampart
#

@tawdry mulch any other method how i can change bg color and size etc ?

noble star
#

@warm rampart are u using tkinter ?

warm rampart
#

yes

#

i have posted my issue above

noble star
#

check this reference
you'll find every thing

warm rampart
#

ok thanks

tawdry mulch
hoary pine
#

i want the left touch the bottom

#

but for some reason i cant

#

##Making the terimnal
bo= Frame(root,height=20,width=width,bg=colors[1])
bo.pack(side="bottom")

bol=Frame(root,height=200,width=100,bg=colors[1])
bol.pack(side="left",pady=(height-89,25))

tawdry mulch
hoary pine
tawdry mulch
hoary pine
#

am not really good at grid can you write code for me? theres not problem if you decline this order

tawdry mulch
hoary pine
#

this is what i want

#

in the middle is output

tawdry mulch
hoary pine
onyx spoke
#

Can someone using pyqt5 help me

digital rose
#

anything to change?

hoary pine
#

How to color a certain word inside inside an entry

tawdry mulch
# digital rose

are you using QStackedWidget, try adding animation between the pages

tawdry mulch
#

With that said, you can make a Text be like an Entry, but not an Entry be like a Text.

tawdry mulch
digital rose
#

QtWidgets.QWidget

tawdry mulch
digital rose
#

what do you mean by that

tawdry mulch
digital rose
#

i created it myself, but i can send the code for the main file here

tawdry mulch
#

Well I would like to see a gist of it....

digital rose
tawdry mulch
proven basinBOT
#

main/main.py line 46

self.ui.back2_btn2.clicked.connect(lambda: self.ui.stacked_wid.setCurrentIndex(0))```
tawdry mulch
#

....to change pages

hoary pine
#

help

#

how do i make entry inside scroll bar

#
scrollbar = Scrollbar(root,bg="#1C1C1C")
scrollbar.pack(side = "right",fill =X)


mylist = Listbox(root, yscrollcommand = scrollbar.set,bg="yellow",fg="black",bd=0,width=10)
for line in range(100):
   mylist.insert(END,str(line))

mylist.pack(side = LEFT, fill = BOTH )
scrollbar.config( command = mylist.yview )
line = Frame(root,bg="white")
line.pack(side="left",fill=Y)
############
scrollbar = Scrollbar(root,bg="#1C1C1C")
scrollbar.pack(side = "bottom", fill = BOTH)

mylist = Entry(scrollbar)


mylist.pack(side = "left",fill=Y)```
#

oh am making new scroll bar

#

i will try to solve it

#

and still

#

i will keep trying

#

untill some one comes and helps me

tawdry mulch
modern bay
#

https://paste.pythondiscord.com/tenetuxike.py
This is someone's tkinter program. In the button_clicked function, we figured out that if the repr of item.cget("textvariable") isn't accessed then it returns something like <string object: '0'>, which it says is the type <class '_tkinter.Tcl_Obj'>, but if the repr is accessed then it returns a str. That's why the first line in the loop is repr(item.cget("textvariable")), to force it to only append str because that's what he wanted.
Why does it work like this, and is there a better way to deal with this? I ask because I don't have much experience with tkinter, so it might not be a very good way to solve this.

hallow kettle
#

Hello! I hope you are all doing well. This is my first time using this server and I was wondering if I can get some help with the GUI I am working on. My class Graph() creates a basic pyqtgraph plot which I want to be set as the central widget in my main window. Currently, when it is initialized it pops up as a separate window. How do I fix this?

#

    """ This class creates the real-time plot in the GUI

    Main methods:
        initializeSpace - creates a layout for Graph GUI   
    """
        
    def __init__ (self):
        super(Graph, self).__init__()
        self.initializeSpace()

    def initializeSpace(self):
       
        # Make Widget that will hold everything
        self.widget = QtGui.QWidget()

        # Create basic buttons next to graph
        start = QtGui.QPushButton("Start")
        stop = QtGui.QPushButton("Stop")

        # Create plot
        self.plot = pg.PlotWidget()
        
        # Add grid
        self.plot.showGrid(x = True, y = True)

        # Create Layout
        self.layout = QtGui.QGridLayout()
       
        # Add widgets to layout
        self.layout.addWidget(start, 0, 0)
        self.layout.addWidget(stop, 1, 0)
        self.layout.addWidget(plot, 0, 1, 3, 1)

        # Set layout
        self.widget.setLayout(self.layout)

        #return self.widget
        self.widget.show()```
#
    """ This class creates the Main Window
    """
    def __init__(self):
        super().__init__()
        self.initializeUI()

    def initializeUI(self):

        # Setting Up Geometry of Main Window
        self.setWindowTitle("Menu...In Progress")
        self.setGeometry(100, 100, 800, 500) 
        self.createActions()
        self.createMenuBar()
        self.createStatusBar()


        # Place graph into mainwindow
        self.graph_widget = Graph()
        self.setCentralWidget(self.graph_widget)```
#

Thanks in advance!

tawdry mulch
modern bay
#

I guess I’d expect it to return the same value whether its repr was accessed or not. I’m just wondering why accessing the repr changes the method’s return value, that seems really weird

#

And if the solution is good or not

tawdry mulch
#

textvariable should be tkinter variables