#user-interfaces

1 messages ยท Page 63 of 1

obsidian cypress
wispy root
#

hi
I have written a personal assistant application in python. I want to add an interface to this

#

but I don't ฤฑmport in my project

tropic tide
stray coral
#

There are many different frameworks, PySide2 as mentioned and PyQt5, which is a wrapper for the Qt framework. tkinker is another one but I have no experience with that once.

#

but if you want it simple and fast to make i am guessing tkinker is your best bet, I have been trying to learn PyQt / Qt for a week now and there is alot to learn and the information documentation isent allways the best

digital rose
#

how do I transfer data (like text) from one place to anothor with something like the socket import, Sourse code whould be greatly appreaciated

tropic tide
pine lark
#

someone can tell what should be better?

delicate meteor
#

What do you recommend to use, Tkinter or PyQt?

#

Because I'm new to GUI.

#

And I don't know which library is better.

#

What's the easiest?

runic delta
#

Tkinter is probably easier than PyQt

delicate meteor
#

But what's the difference between the two?

runic delta
#

but you can do more advanced and cool stuff using PyQt

#

both are different GUI frameworks

#

there are many

#

like PySimpleGUI, Tkinter, PyQt, etc

delicate meteor
#

Yeah. I'm kind of new to Python so I don't know a lot.

#

But thanks man. I'll try Tkinter cause I just wanna experiment around.

upbeat lagoon
#

Hey guys. Anyone familiar with PyQt and shortcuts? I'm trying to make a shortcut T+1. but having problems.

self.track_button_sc = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_T), self) #WORKS
self.track_button_sc = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_1), self) #WORKS
self.track_button_sc = QShortcut(QKeySequence(Qt.Key_T + Qt.Key_1), self) #DOES NOT WORK
deep marten
#

Hey guys, I'd like to learn how to learn how to make a modern ui, anyone could suggest me some ways so that I can study them?

spark wyvern
#

for modern ui i reccomend the module kivy

#

kivy is a module for gui making

slate marlin
#

i want to make a new label every time i click a button at changing y axis, how would i go about doing this is i want to save the coordinates so that if i open it again the a new label will be made but it will be relative to the previous labels i made in the first run?

#

this is using tkinter

#

i wanna know a general idea like how would u tackle this problem?

copper aurora
#

Hello all, I actually want one of my image tag in web page to move down on scrolling.
I referred to many online sites but I am not able to fix that.
Can anyone please guide me here.
I want that bike to move down on scrolling

normal jetty
#

hi i would like help with kivy-ios
Im trying to package my app for ios and when i run toolchain build python3 kivy i get the following error

[DEBUG   ] /Users/rehatbir/Dev/Python/STEM-Project/build/hostpython3/x86_64/Python-3.8.2/Modules/posixmodule.c:9197:15: error:
[DEBUG   ]       implicit declaration of function 'sendfile' is invalid in C99
[DEBUG   ]       [-Werror,-Wimplicit-function-declaration]
[DEBUG   ]         ret = sendfile(in, out, offset, &sbytes, &sf, flags);
[DEBUG   ]               ^
[DEBUG   ] 4 warnings and 1 error generated.
[DEBUG   ] make: *** [Modules/posixmodule.o] Error 1
[DEBUG   ] make: *** Waiting for unfinished jobs....
lethal eagle
#

I have intentionally masked certain part of the screen

spark wyvern
#

Do you guys know how to package a kivy application for android?

digital rose
#

@lethal eagle Pysimplegui is a nice module and everything is well explained but It's a bit tricky to get data from Pysimplegui like if you need the data of a button that is typed then it's simple but you won't straight overthink it because I have experienced that. Yeah.

knotty sierra
#

Hey, would anybody look at my app and tell me is this text readable?
You can see that I used a table to display menu options, but for the rest of the program I'm using normal text. Is there something I can change to "make this look better"?

tribal path
#

Maybe see if it looks better centered?

knotty sierra
#

Centered? I don't think that would look "normal". You can see that each line holds a message with input from the user. Can I do something do make it look better, or is it fine the way it is?

tribal path
#

I'd say its fine, I was thinking about centering the lower text initially (before noticing the inputs) could still center the title/logo. Could use colours I suppose if you really wanted, but looks fine as is.

knotty sierra
#

Yea, I might consider adding colours to messages inserted by user. Thanks

tribal path
#

You can force the inputs over as well, so they're lined up. Would be a similar procedure to how you'd center.

knotty sierra
#

Sorry, I don't follow. What do you mean by forcing inputs over? Sounds interesting

tribal path
#

Just padding. Say : <50 or whatever it may be on all them and itll fill til 50 with spaces

#

!d str.format

proven basinBOT
#
str.format(*args, **kwargs)```
Perform a string formatting operation. The string on which this method is called can contain literal text or replacement fields delimited by braces `{}`. Each replacement field contains either the numeric index of a positional argument, or the name of a keyword argument. Returns a copy of the string where each replacement field is replaced with the string value of the corresponding argument.

```py
>>> "The sum of 1 + 2 is {0}".format(1+2)
'The sum of 1 + 2 is 3'
```  See [Format String Syntax](string.html#formatstrings) for a description of the various formatting options that can be specified in format strings.

Note... [read more](https://docs.python.org/3/library/stdtypes.html#str.format)
tribal path
#

So either the format string syntax, or .ljust

river marsh
#

Does anyone have a good source on how to connect a python bot with a web interface

digital rose
#

Hi

#

I use pysimplegui

#

And after my coding is done, i convert it to .exe with auto-py-to-exe

#

But when i press cancel at my script

#

It says Failed to execute myfile.py

#

Please ping me for answer.

serene yoke
#

actually when I import the math library, pycharm shows it in dark grey colour (no significance), it works well with pygame and random library but as soon as I import any other library, it shows it in dark grey colour

#

no, it shows all other part of code in dark grey

#

except that was written earlier

#

leave m doing it in IDLE, pycharm is confusing

sour tide
#

I think I might be doing this wrong...

#

I made a gui with PyQt5 designer. Then I converted it to a .py file with PyUIC. Now I've been adding functions and connecting the buttons in the in the same .py file

digital rose
#

Does tkinter have a way to resize widgets as you resize the main window?

lofty pond
#

@digital rose Which Geometry Manager are you using.

digital rose
#

Sorry I solved it

#

Thanks

#

My first accomplishd tkinter app

#

๐Ÿ˜„

lofty pond
#

๐Ÿ‘ โ€‹

digital rose
#

so i have a small question

#

should i use tkinter or PyQT

digital rose
#

@digital rose well if you're a beginner then go with Tkinter otherwise go with pyqt

plucky sky
#

Iโ€™m using tkinter and was wondering how you can add a line to a canvas after already packing it

#

I tried doing canvas.pack_forget(), adding the line, and then canvas.pack()

#

but that didnโ€™t work

digital rose
#

Not long. Learning how to do it is what takes so long.

#

Took me about 5 hours total including researching how.

#

I could recreate it in 15 minutes.

#

wew

#

I could teach you in less than that though.

north ore
#

buildozer automates the process of manually downloading python-for-android dependices, java sdks, and java jdks or whatever it is called

spark wyvern
#

@north ore yes i tried that but loads of errors come whenever i use like a tutorial on yt or some web

north ore
#

i managed to fix mine, with some expereince. One thing to note is do not use the PyPi version of buildozer

true wolf
#

yo

#

has anyone built any ui around open gl? ๐Ÿ˜„

digital rose
#

Hello! i have a question , i have installed Pillow ( PIL ) but whenever i try to use it i get an error saying theres no module called PIL. how can i fix this?

digital rose
#

anyone?

tribal path
#

Run the install in that terminal, does it say already installed?

digital rose
#

yeah

#

it does

#

it says that its already installed.

#

@tribal path (sorrry for the ping , i need help asap kinda)

tribal path
#

Can you post a screenshot showing that? Somehow must be different pythons still

digital rose
#

alright. a minute

tribal path
#

Yea thats 3.8, the terminal above is using 3.9

digital rose
#

oh

#

what should i do to fix it?

tribal path
#

py -3.9 -m pip install pillow should do

digital rose
#

its not giving an error anymore!

#

thank you so much.

#

im still a beginner so if i have any questions ill be making sure i ask them here, thank you so much <3

tribal path
#

np. What you had there is pretty common, just due to different python.exes being used

maiden panther
#
def clicked(bt):
    resultl.configure(text=bt)
    
btOne = Button (window, text="1", command=lambda: clicked(btOne))
btOne.grid(column=1,row=1)
#

how do i get the value of the button's text?

#

in tkinter

tribal path
#

bt.text ?

maiden panther
#

i tried it says AttributeError: 'Button' object has no attribute 'text'

tribal path
#

Any reason for passing (btOne) instead of ("1")?

maiden panther
#

yes it's dynamic

#

but i found the solution

#

bracket notation instead of dot notation

#
def clicked(bt):
    resultl.configure(text=bt["text"])

#

thanks tho

maiden panther
weak trout
#

Hi. Is there a way to hide the minimize and maximize buttons on a window in PyQt5? something like this:

digital rose
#

It is incredibly annoying that you cannot use the fill attribute when using grid() in tkinter.

#

With grid I can control exactly where widgets go, with pack it's more annoying process to have to track down where a widget fits into the grid.

#

but pack lets me use the fill attribute...

#

_<

digital rose
#

tkinter is so disappointing.

#

it's really great and easy.. but how can you not pack into a grid? that is an insanely important thing!

#

I am not sure how to move forward. This is a big problem not being able to pack widgets into a grid.

#

I think I found a workaround. Pack 3 frames with side=left, then pack 3 labels in each frame and they will stack vertically. this will create the illusion of a grid. I'll try and post results.

digital rose
#

I finally made a grid using pack. It looks pretty nice and also scales when you resize the window.

#
import tkinter as tk

def main():
    
    Root = tk.Tk()
    Root.title("Packed 3x3 Grid")
    Root.geometry('1366x768')

    C1 = tk.Frame(Root, bg='gray', borderwidth='1')
    C1.pack(side='left', fill='both', expand='true')
    C2 = tk.Frame(Root, bg='gray', borderwidth='1')
    C2.pack(side='left', fill='both', expand='true')
    C3 = tk.Frame(Root, bg='gray', borderwidth='1')
    C3.pack(side='left', fill='both', expand='true')
    C1R1 = tk.Frame(C1, bg='gray', borderwidth='1', relief='groove')
    C1R1.pack(fill='both', expand='true')
    C1R2 = tk.Frame(C1, bg='gray', borderwidth='1', relief='groove')
    C1R2.pack(fill='both', expand='true')
    C1R3 = tk.Frame(C1, bg='gray', borderwidth='1', relief='groove')
    C1R3.pack(fill='both', expand='true')
    C2R1 = tk.Frame(C2, bg='gray', borderwidth='1', relief='groove')
    C2R1.pack(fill='both', expand='true')
    C2R2 = tk.Frame(C2, bg='gray', borderwidth='1', relief='groove')
    C2R2.pack(fill='both', expand='true')
    C2R3 = tk.Frame(C2, bg='gray', borderwidth='1', relief='groove')
    C2R3.pack(fill='both', expand='true')
    C3R1 = tk.Frame(C3, bg='gray', borderwidth='1', relief='groove')
    C3R1.pack(fill='both', expand='true')
    C3R2 = tk.Frame(C3, bg='gray', borderwidth='1', relief='groove')
    C3R2.pack(fill='both', expand='true')
    C3R3 = tk.Frame(C3, bg='gray', borderwidth='1', relief='groove')
    C3R3.pack(fill='both', expand='true')

    Root.mainloop()
    
main()```
#

the sauce

#

a packed grid is a little better than a regular grid, because pack() allows you to fill and expand, while a grid() does not.

#

IMHO

#

Ok, apparently I was completely wrong and that is shit. If you pack stuff into the frames, they just change size because of expand. I give up.

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
#

This is the final version. Idk. Do what you want with it. It works, but it's finicky because the expand reactions to when you pack new widgets into the rows.

#

An example of a text box placed in column 2 row 2

#

It's actually not bad, considering it sort of flexes to what you put into it. I am sure it can be adjusted.

visual timber
#

It

digital rose
#

Using what?

visual timber
#

It's in the bottom-left corner.. If yuou click that box that says "Python 3.x.x..." You can select what python interpreter you want to use

digital rose
#

I actually have no idea what you're talking about.

#

I use pythons IDLE.

visual timber
#

I was responding to someone else

digital rose
#

OOPS!!!

deep hornet
#

hi

#

what is the error in this

near gulch
#

dunno

#

sorry

coarse dew
#

hey does anyone know whats better for begginars, pyqt or tkinter

#

and from where can i learn them

near gulch
#

I havent had any experience with them

#

But you could use Visual Studio

#

or if you want simpler, use Visual Studio Code

woeful niche
#

@thin ore i tried those options but none of them work

thin ore
#

@woeful niche Can you show what you have ?
Perhaps you should claim a help channel for that.

digital rose
#

tkinter is easiest

#

@coarse dew

coarse dew
#

Thanks

#

Do you know a good course for it?

unique forge
#

one

#

it has QT Designer (drag and drop)

modern marsh
#

QtQuick is amazing

#

@unique forge do you know of any tutorials from yt or blogs for PyQt5 - modern gui

#

Like more advanced than standard operations

#

Custom buttons etc

unique forge
#

@modern marsh pyqt5 isnt modern???

#

also, I dont have a tutorial sorry

#

QtQuick is amazing

deep hornet
#

hi

#

`from tkinter import *

screen = Tk()
screen.title("Remainder Setter")
screen.geometry(20 * 30)

entry1 = Entry(screen, width=50)
entry1.pack()

def myclick():
mylabel = Label(screen, text="Remainder: " + entry1.get())
mylabel.pack()

btn = Button(screen, text = 'Save remainder', command=myclick)
btn.pack()

screen.mainloop()`

#

what is the error

digital rose
#

@deep hornet

#

is it the *?

#

in geometry

deep hornet
#

it worked thx

#

:0

#

๐Ÿ™‚

digital rose
#

๐Ÿ‘

deep hornet
#

hi

#

wut is the rror

#

@digital rose

digital rose
#

looking

deep hornet
#

ok

#

did u found

digital rose
#

Hi, can anyone tell me what i can do to fix this? basically what im doing is im putting all the jpg files in my folder into a list , and then im making a button which when clicked goes thru the list by +1 and shows the next image , what can i do to fix this?

coarse dew
#

Do you know a good course for pysimplegui

#

?

digital rose
#

@coarse dew Unfortunately ,There is no good course on Pysimplegui but I think the documentation they have is nice and you can easily pick up it so try your best and search for any YT Tutorials .

coarse dew
#

Do you know a good course for TKinter?

digital rose
#

@coarse dew yes

hushed sorrel
#

Hey, I am trying to get python code to 'production' - in the sense that I want clients to just be able to run 'main.py' without too much effort. I know I can create an executable, but what are other clean ways to do this?

#

the file needs access to local storage

#

for instance, is py2exe recommended if I want to give it to clients? (security-wise etc)

hushed sorrel
#

Your index is out of range

#

have you tried remocing the +1?

#

removing*

digital rose
#

@hushed sorrel thing is i want the button

#

to go thru the images in the list

#

so i did +1 meaning the index should be added by 1

#

what do you think i should do?

#

can anybody help?

modern marsh
# deep hornet

as far as i know, grid and pack cannot be used together. Use place or pack instead of grid

deep hornet
#

ok

modern marsh
#

how do i make custom buttons in QtDesigner

eager beacon
#

@modern marsh What do you mean by customized button?

unique forge
#

anyone who thinks Qt Designer isnt very modern, check out Wandersons YT channel

#

he has amazing skill, his UIs look amazing

#

and he uses Qt Designer and PyQt

#

๐Ÿ”— PATREON:
Many people asked me to create a Patreon (thanks to everyone, you are amazing โค)!
If you can help me keep creating new videos about technology and that amount will not be missed for you this will help to share knowledge FOR EVERYONE!
https://www.patreon.com/WandersonIsMyName

๐Ÿ”— DISCORD: https://discord.gg/WufW3ZHZyX

A time lapse show...

โ–ถ Play video
modern marsh
#

oh

#

i saw his qtquick stuff

#

had no idea he does this too

#

thanks a lot :))

#

why do i feel like QtDesigner is easier to use than QtCreator

eager beacon
#

From a UI file design perspective its pretty much the same but creator has a ton of features that designer doesn't.

modern marsh
#

like?

#

i saw some extra widgets

#

but other than that ?

eager beacon
#

Its a complete IDE for Qt, a Qt Documentation viewer, It has a library of sample code examples you can build/read, etc

#

I think you can even use the IDE for PySide2 projects now

modern marsh
#

nice

#

one more thing

#

can I access .ui files inside the design editor in qtcreator

#

like, qtdesigner makes .ui files

#

but qtcreator does .qml ones

#

which i am not very familiar with

eager beacon
#

creater does .ui files too

modern marsh
#

oh

eager beacon
#

you can open that window from File>New File or Project

modern marsh
#

oh

#

nice

#

thanks

#

but i guess qml has more features?

eager beacon
#

I don't know if I'd say it had more features but some features in QML are easier to implement that they would be using QtWidgets

digital rose
#

If anyone has trouble running their program using tkinter, it's because mainloop is blocking. Use update() to allow your program to run with it.

import tkinter as tk

Root = tk.Tk()
Root.title("Without mainloop")
Root.geometry('1366x768')

TextBox = tk.Text(Root)
TextBox.pack()

loopActive = True
while loopActive:
    Root.update()
    if not loopActive:
        Root.quit()
    else:
        #do thing```
digital rose
#

idk if this applies but im trying to make it so the user can input a text and then tts will speak it. I downloaded gtts btw:
from gtts import gTTS
import os

List = input("Write your list")

myText = List

language = 'en'

output = gTTS(text=List, lang = language, slow=false)

output.save("output.mp3")

os.system("start output.mp3")

#

i beg of u guys

#

from gtts import gTTS
ModuleNotFoundError: No module named 'gtts'
thats the error

#

Pls ping me if u have an answer

stray coral
#

So I am using Qt Designer to make the layout forms for my program.
I transform the ui files into py code pyuic. I dont edit the Forms produces but load them in a custom class with their setupUi(). All good so far.
But I was wondering if its feasible to make context menus with Qt Designer also, or if I should just hand code its layout in my CustomView classes?

weak trout
#

Hi. What's the best way of displaying text into PyQt5? I use QLabel and then with setText('some text') I write the text I want, but I notice you can use HTML syntax for it. Is it good to use it? Because I find it easier using HTML syntax. The bad thing is that the string gets longer and longer, so I don't know if it's really the best approach

proud rapids
#

Hi Can anyone give me some insight into whats causing this error ? Im using Django 3.1.4 and python 3.8.6

proven basinBOT
#

Hey @proud rapids!

It looks like you tried to attach file type(s) that we do not allow (.pdf). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.

Feel free to ask in #community-meta if you think this is a mistake.

#

Hey @proud rapids!

It looks like you tried to attach file type(s) that we do not allow (.rtf). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.

Feel free to ask in #community-meta if you think this is a mistake.

proud rapids
#

Hi Can anyone give me some insight into whats causing this error ? Im using Django 3.1.4 and python 3.8.6

maiden dragon
#

is it possible to have a bitmap button in the same place that i have text boxes

#

like the text boxes are on top of/inside of the bitmap button bounding box?

unique forge
#

I'm making a app with PyQt5 and want to open file manager, so I can choose a folder, and then I will os.chdir to that directory
how can I open file manager and save the path chosen in a variable?

maiden dragon
#

basically a button that i can have editable text on top of

unique forge
#

@maiden dragon thats not a GUI question

maiden dragon
unique forge
#

you said you were using Django

#

oh wait, sorry, that was someone else

maiden dragon
#

lol yeah never used Django no idea what it is

#

all good

unique forge
#

Django is a website framework

maiden dragon
#

ah

shrewd mauve
#

Hi, I'm trying to make an app for my friend. It will be a gift for her to cherish our past relationship. It's probably going to be a simple app, where there's the main menu accompanied with some buttons. The buttons will take the app to a new window depending on the button clicked. For example the first button is simply for my message to her. The second button is for my favorite pictures with her. The third one is for my favorite memories with her. I'm a 1st semester CS student and I've only learned Python, with basic understanding of Tkinter. If anyone knows the easiest way to create the app please do tell me. It doesn't have to be coded, maybe there's an app that can help me realize this. Or if you're free and are willing to help me please kindly DM me, Thank you!

modern marsh
#

in PyQt however , idk

#

perhaps you can implement a bit of tkinter in your app?

unique forge
#

i figured it out

#

its fine

modern marsh
#

oh, how to do it?

#

it might be useful for me later on

unique forge
#

@modern marsh ```py
self.path = QtWidgets.QFileDialog.getExistingDirectory(None, 'Select Music folder:', 'F:\', QtWidgets.QFileDialog.ShowDirsOnly)

#

@shrewd mauve you should use PyQt5 with Qt Designer

#

and use stacked widgets

modern marsh
#

thanks :))

shrewd mauve
unique forge
#

no, its very easy

#

especially with Qt Designer

#

just drag and drop

shrewd mauve
#

I don't even know how to create a program that calls multiple .py files.

#

Alright thanks I'll try learning it, do you mind if I DM you for help later?

unique forge
#

sure, DM me

shrewd mauve
unique forge
#

yep

#

I'll teach you everything

shrewd mauve
#

Thank you so much

unique forge
#

start with installing Qt Designer

#

it should be online

modern marsh
#

yeah qtdesigner is easy

#

doing it all manually tho is tough

#

but even then, to do a basic - tkinter like styled app, its easy

shrewd mauve
modern marsh
#

what does?

shrewd mauve
#

normal tkinter code

modern marsh
#

ahh no

#

use ttk

#

ttk has styles that have modern configs

shrewd mauve
#

i'm too much of a newbie i guess

#

it's like a theme for tkinter?

modern marsh
#

uhh

#

i do not know exactly how they relate

#

im guessing ttk is a part of tkinter

shrewd mauve
#

i see, thanks for the info.

modern marsh
#

ye

weary wolf
#

Here's my code:

import subprocess

subprocess.call("ssh santiago@192.168.56.101", shell=True)

I'm building an electronjs app and I want to use python with it as I'm more familiar with it. I want to have a page that has an interactive terminal that displays on the window of the program. I have created a script in python that would allow you to do this in the terminal console however how can I use this code with electron to make a friendly gui terminal that you could use like any other.

lost lance
#

Hi @weary wolf , I've told you once before! This is not a valid question for this channel. Please ask in the Electron server on Discord or StackOverflow! :)

weary wolf
#

Sorry but this is a user interface channel so I think it is exactly where I should be asking.

unique forge
#

@weary wolf he just told you, also this is a python server

lost lance
#

@unique forge I already took care of the situation, there wasn't a need for you to comment.

unique forge
#

he asked another question though

lost lance
#

And I responded.

frank slate
lofty pond
#

That is very cool

coarse dew
#

hey i need help
i cant find my desiner app

modern marsh
#

download QtDesigner

#

the app is usually somewhere in the python directory afaik

analog field
#

is there a way to have a Hover over a button event?

#

(using PyQt5 with Python-3.x)

royal saddle
digital rose
echo fox
#

Those "join our discord" and "visit us at" look kinda forced in, maybe move under the "welcome to ace launcher" and make transparent? @frank slate

deep hornet
#

hi

#

what is the error

eager beacon
#

The first line in your message() function has one too many spaces in front of it.

proven basinBOT
#

:incoming_envelope: :ok_hand: applied mute to @deep hornet until 2021-01-20 15:58 (9 minutes and 59 seconds) (reason: newlines rule: sent 12 consecutive newlines in 10s).

fickle rivet
#

!unmute @deep hornet

proven basinBOT
#

:incoming_envelope: :ok_hand: pardoned infraction mute for @deep hornet.

fickle rivet
#

!paste Please use a paste service for that

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.

deep hornet
#

ok

eager beacon
#

@analog field Only QGraphicsItem and objects subclassed from it contain hoverEnter/Leave events. If you're only interested in changing the appearance when a hover occurs you can use a stylesheet for that, otherwise you can use the enterEvent() but an enter event occurs any time the widget gains focus. That could happen from someone pressing the tab key, so you need to be careful with that.

#

The stylesheet for a hover event look like this: QPushButton:hover { color: #CCC }

analog field
#

@eager beacon Thanks, I figured it out a little bit ago but forgot to mention it here
Either way, your help is appreciated!

digital rose
#

why isn't this working? ```py
def make_tab():
from tkinter import Tk
a = Tk()
a.after(100, make_tab)

make_tab()```

#

lol i forgot mainloop

proud rapids
#

can someone assist me with a Django issue in help-sulfur ?

maiden dragon
#

idk im just repeating what they said

#

Does anyone know a way i could make it so the arrows in this diagram (which is the background of my GUI) could highlight when you hover your mouse over parts of the image

leaden whale
#

how do i make a scrolledtext take up to columns (tkinter)?

#

or have a input and a button take up one

digital rose
#

Hi Guys

#

is this application good?

lament mantle
#

I'm not very good at design, but, I can say that I think you accidentally spelled create wrong @digital rose.

digital rose
#

ah lol

#

sorry I will fix it

#

thx for telling me

#

that made in Tkinter

#

bye

royal meteor
#

I managed to delete all metro windows app

frank slate
storm magnet
#
import datetime

class Countdown(tk.Frame):

    def __init__(self, master):
        super().__init__(master)
        self.create_widgets()
        self.seconds_left = 0
        self._timer_on = False

    def show_widgets(self):

        self.label.pack()
        self.entry.pack()
        self.start.pack()

    def create_widgets(self):

        self.label = tk.Label(self, text="00:00:00")
        self.entry = tk.Entry(self, justify='center')
        self.entry.focus_set()
        self.start = tk.Button(self, text="Start",
                            command=self.start_button)

    def countdown(self):
        self.label['text'] = self.convert_seconds_left_to_time()

        if self.seconds_left:
            self.seconds_left -= 1
            self._timer_on = self.after(1000, self.countdown)
        else:
            self._timer_on = False

    def start_button(self):
        # 1. to fetch the seconds
        self.seconds_left = int(self.entry.get)
        # 2. to prevent having multiple
        self.stop_timer()
        # Timers at once
        self.countdown()

    def stop_timer(self):

         if self._timer_on:
            self.after_cancel(self._timer_on)
            self._timer_on = False

    def convert_seconds_left_to_time(self):

        return datetime.timedelta(seconds=self.seconds_left)

if __name__ == '__main__':
    root = tk.Tk()
    root.resizable(False, False)

    countdown = Countdown(root)
    countdown.pack()

    root.mainloop()

#

anyone know why my GUI doesn't show?

#

It only shows the X to close it

#

like where itd be on the top right

digital rose
#

try setting geometry for default width and size or set the state attribute to zoom for full window

storm magnet
#

Well I can stretch it out to be a full window GUI but there's nothing in there

#

even tho there should be a counter

amber roost
digital rose
#

this is tkinter nice

#

the problem is you don't showing the widgets

#

by place or pack or grid

#

for example:
this will be don't showing any thing just the window

from tkinter import *

root = Tk()
root['background'] = "#323232"
root.geometry("600x400")
root.title('test')
# Let's add button
btn = Button(root,text="Click me",bg="#242424",fg="white",borderwidth=0)

root.mainloop()
#

but when I .pack() the btn

#

like this:

#
from tkinter import *

root = Tk()
root['background'] = "#323232"
root.geometry("600x400")
root.title('test')
# Let's add button
btn = Button(root,text="Click me",bg="#242424",fg="white",borderwidth=0)
btn.pack()

root.mainloop()
#

the output is:

#

the button is showing up

#

you can use .place(x=*intvalue*, y=*intvalue*)

#

to put specific place

#

for example: btn.place(x=100,y=200)

#

also you can use .grid(row=*intvalue*, column=*intvalue*

#

this will be make a net

#

in the window

#

for example: btn.grid(row=5,column=2)

#

I hope you now know what I talking about.

viscid halo
#

Hey, what would be my best approach creating a python desktop app that uses html and vue for the UI, where i can send data to the UI and react to actions of the user? It's only for personal use, not for publishing

frank slate
#

Hey, on my Python Tkinter GUI project, i need help on this page. The SELECT THEME button is supposted to copy a zipfile into the project files and then it is supposted to get unzipped there, and then it replaces an existing file. Can anyone help me on this?

#
def selectTheme() :
    filename = filedialog.askopenfilename(initialdir="/", title="Select Theme File",
    filetypes= (("Ace Theme File", "*.zip"), ("Ace Theme File", "*.zip")))
    shutil.copy(src=filename, dst="Buttons")
    with zipfile.ZipFile('Theme.zip', 'r') as my_zip:
        my_zip.extractall('MainPages')
    shutil.copytree(src='MainPages', dst="Buttons")
eager beacon
#

shutil.copytree doesn't overwrite directories if they exist. you will need to check if the directory exists and remove it before using copytree

frank slate
#

how can you delete files with tkinter

eager beacon
#

I don't know how to do it with tkinter but you can use shutil since you've already imported it

frank slate
#

how

eager beacon
#
if os.path.exists(dir_path):
    shutil.rmtree(dir_path)
frank slate
#

ok thanks

#

ive already imported os aswell so thanks

#

another question. how do i unzip files in another directory

#
    with zipfile.ZipFile('Theme.zip', 'r') as my_zip:
        my_zip.extractall('MainPages')

This only can unzip files in the same dir, but other dir doesnt work

#

or how do i move files into local dir with shutil

#

i mean the same dir

eager beacon
#

You probably need to provide a full path to the directory where you want the files extracted to

frank slate
#

nono i want to extract a file in a different directory

#
    with zipfile.ZipFile('Folder\Theme.zip', 'r') as my_zip:
        my_zip.extractall('MainPages')
#

that doesnt work

eager beacon
#

Give it an absolute path and it should work C:\Path\To\Folder\Theme.zip

#

Assuming Folder has Theme.zip inside it.

frank slate
#

oh you cant do local files?

eager beacon
#

If you want to read a zip file in another directory in your project you can give it a relative path but you have to take into account the working directory where your zip extract code is written

#

Its hard to give any more specific advice without knowing the directory structure of the project, where the zip file you want to extract is and in which file the extract code is written in.

waxen wadi
#

I've just tested Tkinter, is there a table like widget ?

#

(working on a product manager)

eager beacon
#

I think you'd have to use the one from the ttkwidgets library or build your own.

ebon cairn
#

closest is the ttk.Treeview

waxen wadi
#

closest is the ttk.Treeview
๐Ÿ‘

#

I see

#

Honestly, I recommend ttk to every decent Tkinter user py_guido

hazy delta
#

My button's command runs when it's initialized, but not when the button is actually pressed.

eager beacon
#

thats probably because your command is a function call, likely you just need to remove the parenthesis from the function in the command

hazy delta
#

Yeah, I read a stackoverflow answer saying the same thing you did at the same time you said it

#

It behaves as expected now... at least, that part.

eager beacon
#

awesome

hazy delta
#

This is my first time using Tkinter, so mistakes like that are to be expected

eager beacon
#

yeah, working with GUIs can take some getting use to but its a fairly short learning curve.

hazy delta
#

short on the X axis but tall on the Y axis -- it doesn't seem to take a long time to learn, but it's hard within that short time

digital rose
#

When using bind() in tkinter, is this a one time line that occurs or do you have to do a bind in a loop?

#

I figured it out, just had to bind it in the main loop

digital rose
#

How do I make it so the user cannot click into a text box?

lofty pond
vernal yarrow
#

is there anyone?

#
bilgiler = [numara,ad,soyad,phone,adres]

bilgiler[numara]= input ('numara gir')
bilgiler[ad] = input ('ad gir') 
bilgiler[soyad] = input ('soyad gir')
bilgiler[phone] = input ('cep numara gir')
bilgiler[adres] = input ('adres gir')

ogrenci = { 'numara': bilgiler[numara] ,'adฤฑn' : bilgiler[ad], 'soyad' : bilgiler[soyad] , 'numarasฤฑ' : bilgiler[phone] , 
           'adresi' : bilgiler[adres]
          }

print (ogrenci)

```
#

why it's not working? where is the problem?

lofty pond
#

This is #user-interfaces , open a help channel by putting your question in one of the available ones

eager beacon
vernal yarrow
#

I don't get that how it's working. it opens a channel but I can't write anything

lofty pond
digital rose
#

I wish python had a gui tool like grapejs for javascript ๐Ÿ˜ฆ

unique forge
#

@digital rose python isnt really for web dev

digital rose
#

i didnt mean for web

#

I meant just for guu

#

gui

lofty pond
#

There is eel

digital rose
#

@lofty pond The disable thing isn't effective because it doesnt allow me to insert into it while it's disabled.

#

Is there a way to make it so you cannot click on the widget? like a loop which unfocuses the mouse cursor?

lofty pond
#

I think there is readonly state, which allows you to insert, if that doesn't work, you could just enabled it before you insert and disable afterward

digital rose
#

I tried that approach but the way i'm using the text box I can't enable and then disable. I will try the readonly thing.

lofty pond
#

To change a state of a widget before and after, just use:
widget.configure(state="state")

digital rose
#

Ok

copper aurora
#

Can anyone please tell me how to add URL for lottie animation in html <lottie-player> that I have made myself (lottie.json) it is in JSON.
I am not using the animation from community of lottie files hence I don't have the URL for it.
When i used file manager's url, it showed CORS error.
What should I do?

unique forge
#

@digital rose have you tried google search?

#

I found a couple stuff

digital rose
#

hi

stray coral
#

So I need to be able to stick or anchor my windows together side by side in groups.
I could use eventFilters and just move the attached windows relative to the one being moved.
But I was wondering if there is an easier way. Google yielded little information.

#

Im working with pyQt

eager beacon
#

@stray coral
If I'm understanding the problem correctly, the answer is to create QWidget with a layout and add them to the layout after they are created.

stray coral
#

@eager beacon Hmm, that could work. Then just detach them from the QWidget when separeted, making it a standalone window again?

#

didnt know one could detach a QWidget from its parent

#

neat

eager beacon
#

You can't simply detach an existing widget from its parent if its a QWidget. You can however do that with a QMainWindow using a QDockWidget

#

You could just make it so when only one widget is in the dock it would not be removed. This would be to avoid having an empty main window hanging around. It would probably be more complicated than setting the position of the widgets based on the topRight position of their rect

neon ridge
#

hi

pure cloak
#

it looks kinda blurry and like it's meant for windows 7 or windows vista

#

on macos it looks fine but it looks like this on windows

eager beacon
#

The only crisp part is the title bar which is controlled directly by windows ๐Ÿ˜ฆ

tribal path
#

hdpitkinter look any different @pure cloak ?

soft scarab
#

Anyone in here who is familiar with briefcase/beeware? if yes i got a question:
Can i use other languages than "toga"? example tkinter?

left haven
#

Hey guys I was wondering how tkinter works when updating the canvas, does it redraw everything at each update or computes what's already present and add what's necessary to not waste resources?

#

It's an important question because I'm planning to use tkinter to draw a PIL image on the canvas, but this PIL image is costantly updating with new elements (basically generative art)

digital rose
#

If there is someone, who can help me with tkinter, please DM me

upbeat nacelle
#

I normally work in backend, but I have frontend web dev experience, and was wondering if there's a preffered python package for GUI. I've dabbled in tkinter and wasn't a huge fan, what other ones are there?

digital rose
#

@upbeat nacelle PYQT5 or Pysimplegui, you can select one of them

queen vector
#

pygame.init()
surface = pygame.display.set_mode((1280, 820))

def start_the_game():
pass

menu = pygame_menu.Menu(820, 1280, 'Welcome',
theme=pygame_menu.themes.THEME_ORANGE)

menu.add_text_input('Name :', default='DRIVEN TO LEARN')
menu.add_text_input(' Move the car with the arrow keys and dodge all obstacles, obtain a score of 250 to win')
menu.add_button('Play', start_the_game)
menu.add_button('Quit', pygame_menu.events.EXIT)

menu.mainloop(surface)
Could someone pls help what do I do at the def start_the_game function I'm done my game it's just the menu play button won't work and I don't know how to def start_the_game im new to python
THIS is due tmrw I am done my game just need some help to start the game through the menu if someone could pls help it would be appreciated.... this is for the menu for my game I have already made the game I just need the menu to play the game

slow chasm
#

How do I make it so that if the user expands the window horizontally, the window also expands by the same amount vertically and vice versa?

#

Basically I want the window to be square even when the user resizes the window (but I don't want to restrict resizing entirely)

slow chasm
#

.
How to clear all widgets from the Tk() window

vague gale
#

why doesn't hide() work in pyqt?

unique forge
#

MyWindow.hide()?

vague gale
#

no it was for a label, i forgot to call the function that hides it though ๐Ÿ˜†

hoary thicket
#

Is this UI ok. Or do I need to make any changes to make it better. Designed without Designer. Androix86 Installer

wary birch
#

Hi guys, quick question: is python a reliable language to make a deliverable GUI?

#

I tried once do a very simple user interface with PyQt5 and then tried to "box" it up on an executable but it occupied a lot more space than it needed. Admitedly I was doing it very naively and probably wasn't very careful with the imports and the executable was done with Pyinstaller and was not carefull with anything, just followed a simple tutorial

#

I'm just wondering what the overall opinion may be

ebon tartan
#

I never worried about weight (i don't have much experience), but yes with the libraries out there, you can do anything in a somewhat efficient way

unique forge
#

@hoary thicket I think it looks great

vague gale
#

what should i use to make the thread sleep in pyqt?

#

time.sleep would just block the program

vague gale
#

you're not even compiling it, you just packing it

wary birch
#

What should i look for then?

surreal wing
#

Well QT itself is modular to a point of plugins so you may not need that whole library for your deployment but I'm not sure how that maps to python bindings

#

Out of curiosity how it stands for you which version of QT what is used and how big the end package is

#

Is it like 30MiB, 150MiB, 600MiB

#

Well Im bit late ๐Ÿ˜‚

delicate latch
#

is pyqt as capable or mature as electron? For example would I be able to build something like discord or microsoft teams using pyqt? Also is it as fast?

eager beacon
#

Yes, it's just as capable as electron. Qt was released something like 20+ years ago so its a very well structured, easy to understand and use library. PyQt is just a wrapper around C++ Qt so its probably just as fast as electron if not more so.

lone phoenix
#

definitely needs less ram than electron

delicate latch
#

so umm i would be able to build something like discord with it?

eager beacon
#

Could you be more specific?

delicate latch
#

the issue is that i have not seen any big apps built with pyqt

#

i might be wrong though

#

it's just that i'm not really confident about picking up pyqt instead of electron

#

i really wanna because i'm good with python

#

but i haven't seen many big apps built with it

eager beacon
#

PyQt is a wrapper around Qt. Most companies don't have a good reason to write an app in PyQt when they have software devs who already know C++ and can use Qt.

#

I know Dropbox used PyQt for its desktop app.

#

There are tons of companies that use Qt to build their apps because its hands down the best cross platform framework for creating desktop applications.

#

Pretty much every Movie/Animation studio uses either PySide2 or PyQt5 to build internal tools, they also use it to create plugins for the apps they use that support Qt.

#

Adobe made all of its desktop software with Qt until around 2018 when they switched to the native frameworks. Autodesk uses it to build its applications. Houdini and Krita also use Qt.

#

If you plan to build something like discord though, a large part of your work won't involve the PyQt or Electron at all.

delicate latch
#

and is pyqt a really good wrapper for qt?

#

is it as good?

eager beacon
#

I don't understand the question

delicate latch
#

is it as good as using qt itself?

eager beacon
#

you write python code, it executes the Qt code

delicate latch
#

alright

eager beacon
#

its just a way to use Qt from Python

delicate latch
#

hmm alright

#

how does it compare to a more popular framework like electron?

eager beacon
#

In which way

delicate latch
#

lol discord, microsoft teams, and atom were all built with electron

#

it's why i'm nervous

lone phoenix
#

sidenote: PySide2 is the better Qt wrapper AFAIK

eager beacon
#

They use it because its easy to style

#

And yes, Pyside2 is maintained by the same company who makes Qt

#

I'm pretty sure PyQt5 is just one guy.

modern marsh
#

wait

#

isn't PyQt5 open source and PySide2 non open source - needs a license to use for commercial purposes?

eager beacon
#

PyQt5 requires a license for commercial apps period. Both PyQt5 and PySide2 may require you to have a Qt license depending on which modules the application includes.

#

There are also some modules in Qt that you can not use in your app unless it is open source.

delicate latch
#

hmm alright

modern marsh
#

ahh ok

digital rose
#

is this channel about pyautogui too?

mighty rock
#

i guess

modern marsh
#

yes

sudden geyser
#

can i really sell a Software made using Tkinter๐Ÿ˜…

unique forge
#

@sudden geyser I guess...

#

wouldn't be very good though

#

tkinter looks like the 90s

modern marsh
#

has a style for modern windows designs

unique forge
#

or PyQt

sudden geyser
modern marsh
#

yes

muted crystal
#

anyone able to help, how i put my code into the gui?

sudden geyser
#

Which one?

digital rose
#

does the Qt Designer work with PyQt?

modern marsh
ivory ember
#

know a lot of PyQt5

#

dm me

untold swift
#

hey guys, ive been having some problems with kivymd. i had a top toolbar working properly, but when i added a floating button on the bottom of the screen, everything else disappeared. can anyone help me?

digital rose
#

any kind of whole numbers

digital rose
#

def button1_klik():
time.sleep(1)
canvas.create_oval(222.5, 195, 275, 240, fill="red", outline="black")
time.sleep(1)
canvas.create_oval(222.5, 140, 275, 185, fill="orange", outline="black")
time.sleep(1)
canvas.create_oval(222.5, 85, 275, 130, fill="green", outline="black")

#

does someone know how to make this not count 3 seconds but 1, execute, 1, execute etc.?

#

bc now it just waits 3 and then does all three

proven yarrow
#

canvas.after(1000, changes_here)

digital rose
#

thanks man

random harness
#

On Tkinter, how can I make that an Entry, a search bar calls a function whenever I press Enter?
I tried this but it doesn't work

window.bind('Return', function())

rancid sorrel
#

hello everyone is there a way for me to put a label beside a buttton improbably dumb so don't roast me

maiden dragon
#

does anyone know how i could get rid of these squares around my buttons?

inner shale
#

hello! does anyone know what library is the best for UI like buttons and stuff? thanks in advance!

unique forge
#

@inner shale PyQt5

inner shale
#

Thank you @unique forge !

echo creek
#

which gui can i use to make an overlay ?
like the discord one
or like this program

lofty pond
#

They used tkinter for that, not too sure on how.

tribal path
#

For things like that theres likely os (pywin32) stuff going on

tiny musk
#

hello how can i print the information in the window, not in the cmd, when i click a button?

#

im from spain btw, if i write bad

modern marsh
#

btw where can i get the documentation for the stylesheet thing

#

like background-color:rgb()

#

is it css?

eager beacon
modern marsh
#

thanks :))))

modern marsh
#

how do i remove the background in Designer

#

ik how to do it in python

eager beacon
#

What do you mean by remove?

digital rose
#

can anyone go to help aluminium? thanks :p

modern marsh
#

the QMainWindow

eager beacon
#

I don't think you can do that

#

at least not without making everything else transparent also

modern marsh
#

you can afaik

#

ik how to do it manually

#

wait lemme get the code for it

#

ahh nvm i cant find it

#

what i mean is

#

as in make it invisible

eager beacon
#

I don't think you can do that ๐Ÿ˜ฆ

modern marsh
#

i am quite sure you can

#

ahh

#

@eager beacon QtWindow.framelessWindowHint or something

#

found it

#

now how do i implement into designer

eager beacon
#

yes you can do that but I don't think you can apply that in designer since its a flag.

modern marsh
#

ok i will do it manually then

#

thanks :))

eager beacon
#

Alright, it's not quite as easy as just setting the flag if you want a functional window though.

modern marsh
#

oh, what do i have to do then?

eager beacon
#

you have to override the mousePress/mouseMove/mouseRelease methods so you can move the window.

modern marsh
#

ahh properties?

eager beacon
#

and you have to do the calculations about how the window should move based on the press and actually do the movement in mouseMove

modern marsh
#

hmm

#

im sure there is a vid on this

#

which i will refer to

unique forge
#

did you make it functional?

modern marsh
#

designing stuff

unique forge
#

ok

languid ether
#

taht looks good

lost apex
#

Guys , how could i make if event that checks if anything in first list is in the second list ?

grave grotto
#
input_area = Entry(root)
input_area.pack()
input_area.get()
test = input_area.get()


def testing():
    test_2 = Label(root, text=test)
    test_2.pack()


button = Button(root, text='Sumbit', command=testing)
button.pack()
```My text isn't showing
sudden geyser
#

It won't show as the get is called earlier

#

And the value has submitted

#

Move the test inside the function

grave grotto
#

oh ok

sudden geyser
#

Worked?

grave grotto
#

both gets?

#

input_area.get()
test = input_area.get()

#

no.

digital rose
# grave grotto ```py input_area = Entry(root) input_area.pack() input_area.get() test = input_a...

Why you make a variable and why this. for example if you want variable do this:

test = StringVar()
input_area = Entry(root, textvariable=test)
input_area.pack()

def testing():
    test_2 = Label(root, text=test.get())
    test_2.pack()

button = Button(root, text='Sumbit', command=testing)
button.pack()

and if you don't want variable just do this without test:

input_area = Entry(root)
input_area.pack()

def testing():
    test_2 = Label(root, text=input_area.get())
    test_2.pack()

button = Button(root, text='Sumbit', command=testing)
button.pack()

and why you make this line

input_area.get()
```?
digital rose
#

Guys I want help in .bind function

strong oak
#

In what way?

fleet goblet
#

Does anybody else use Google colab with Drive religiously?

plain stirrup
#

for pysimplegui, i can only hit the button to run my script one time, is there any way to let it run my script each time the button is pressed?

tranquil linden
#

I asked a PySide question in #help-chocolate if anyone is around to point me in the right direction

twin ruin
#

hi im trying to make a sudoku solver with tkinter where it shows all the moves its trying to attempt. so far i made it solve it but i want to make it show all the moves on the interface. I tried used .after() and time.sleep() but its not working as in the number isnt appearing in the interface when i try to slow it down can someone help me pls

#

i have a lot of code so its hard to show all of it

#

this is a sample of it

#

without the time.sleep part it solves it instantly

#

but im hoping that it will show every single possible move it is trying

digital rose
#

if u know how to make a Python Menu dm me

modern marsh
#

is there a need to use pyuic for ui files that i create? or is there any other way to access ui files in py

eager beacon
#

Are you saying you don't want to convert the .ui to a .py?

modern marsh
#

uhh

#

yes

#

cant i use it directly in my main py file

eager beacon
#

Yeah, I suppose you could. You can import uic from PyQt5 and use uic.loadUi('file.ui')

#

I've only done this once so I don't really remember all of the details but I think you can inherit that like you would with a .py file that you created with pyuic.

#

you do still have to call self.setupUi(self) in your QWidget,QMainWindow,etc class though

quasi garnet
#

Anyone familiar with how QTableWidget works?
I want to use ItemDelegate to show items but not for editing.

eager beacon
#

If you're using PyCharm and find youself constantly tweaking your UI file you can open your main.py file configuration and on that page you can define a set of scripts to run before launch. You could just put your pyuic command inside a bash script and run it automatically that way

#

I don't think you can use an ItemDelegate with a QTableWidget

quasi garnet
#

It's showing the widget but only when I enter edit mode ๐Ÿ˜ฆ

eager beacon
#

They are meant to be used with Views where you define your own model

quasi garnet
#

I'm using QTableWidget.setItemDelegateForColumn

eager beacon
#

Have you subclassed the ItemDelagate?

quasi garnet
#

Yeps

#

It's showing the widget that I want but only when I double click (edit)

eager beacon
#

I'm not really sure how to handle that outside of an AbstractModel. Thats where you usually handle the Roles(like the EditRole you're seeing)

#

maybe you could do it in the paint event by creating a UserRole for selected, check if its selected in paint event, then you could make it look however you wanted

#

btw, the docs recommend you use the StyledItemDelegate over the ItemDelegate.

quasi garnet
#

Yeah, I'm using StyledItemDelegate right now

#

Maybe I need to override the paint method

quasi garnet
#

Eww, overriding the paint() method is ugly

untold swift
#

hey! i keep getting this traceback error in kivy and i cant seem to fix it:

line 892, in __init__
     App.get_running_app().property("theme_cls", True),
 AttributeError: 'NoneType' object has no attribute 'property'
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):

untold swift
modern marsh
#

why is it that a window previewed in designer is bigger than when running py code

modern marsh
leaden locust
#

Is PyQt5 paid?

unique forge
#

Qt is paid, but not PyQt

leaden locust
#

Ok

unique forge
#

@modern marsh set a fixed size

#

also make sure to remove the surroundings

#
  self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
  self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
modern marsh
noble hatch
#

hello, I got a question
should I learn PyQt or Kivy to make a professional-looking and stylish GUI for a commercial program?

unique forge
#

@noble hatch PyQt5 is great, but so is Kivy

#

it really depends what you're doing

#

Qt has Qt Designer, which makes everything a lot easier

noble hatch
#

apparently, PyQt is paid for commercial use

#

costs 500$ for commercial use, when kivy is free, but I guess 500$ is nothing when it comes to large-scale projects

modern marsh
#

ig PySide 2 wrapper is free

noble hatch
#

should I install PyQt or PySide?

digital rose
#

in pyqt how would i use .setText while in a loop cause everytime it loops it deletes the previous text

#

i want it all the be there

brisk halo
#

@digital rose you can create a QTextEdit object then call insertPlainText("Say What...\n") on the object each loop.

#

or pull the current text value in to a variable then append the new text value then setText the new value...

modern marsh
#

how do i set a fixed size for my widgets in designer?

#

i tried setMinimumSize but it did not work

eager beacon
#

I think you can set the size of the widget by dragging it in designer and using the SizePolicies of Fixed/Fixed for width/height

#

if you're already locked into a layout just set the size you want with minimum and set it to Fixed SizePolicies

modern marsh
#

ooh

#

lemme try that

#

@eager beacon the window is smaller than it is in the QtDesigner preview

#

as i have shown above

#

how exactly do i fix that

#

i tried set minimum size and fixedPolicy

eager beacon
#

which widgets did you apply that to?

modern marsh
#

i applied it to the frame

#

within a mainWindow

#

hmm

eager beacon
#

Apply it to the MainWindow

modern marsh
#

oh ok

eager beacon
#

and remove it from the green widget that's at a fixed size policy

modern marsh
#

so

#

only the mainWindow must be of fixed policy right?

#

others should be at their defaults

eager beacon
#

yes, if others are at their default they should fill the mainwindow

modern marsh
#

hmm

#

it still doesnt work

#

also

#

all of the widgets must have a minimum size right?

eager beacon
#

minimumSize should be 0 if they are at default settings

modern marsh
#

oh

#

i set min size to the object size as shown in designer

eager beacon
#

press the little arrow button to reset it to actual defaults

modern marsh
#

oh ok

eager beacon
#

The red one on the right side

modern marsh
#

ok so i made all the widgets except mainWindow default

eager beacon
#

without that the setMinimumSize will wind up in the .py file from pyuic

modern marsh
#

im doing loadUi

#

so that i do not need to run pyuic i guess?

eager beacon
#

I'm not sure what that does to turn the code into python, I assume it does the same thing as pyuic without creating a .py file you need to import

modern marsh
#

yeah so if i do a = loadUi

#

i guess a will be the mainWindow object of that ui file

#

as per i have tried

eager beacon
#

If you want to paste your .ui file somewhere I can take a look at it but I can't say whats happening with out seeing it.

modern marsh
#

aight

#

!paste

eager beacon
#

yeah use that

modern marsh
#

also Qt.FramelessWindowHint closes the app immediately when uncommented

#

idk why

#

i want that my app to be of the bigger size

eager beacon
modern marsh
#

oh i will check that

#

oh you made a gridLayout huh

#

is it necessary to make layouts?

eager beacon
#

it's not necessary but it would make things so much easier if you used layouts

modern marsh
#

oh will do that from now

eager beacon
#

if you don't like the margins they provide, you can scroll down to the bottom of the properties and set the contents margins to 0

#

like you'll probably need to do that with the widget i put the window control buttons in

modern marsh
#

what margins?

#

the stuff outside the frame?

eager beacon
#

see how the top buttons are further down from the top and further from the right?

#

its because the green box has a margin of 12, and so does the widget that the 3 buttons are in.

modern marsh
#

oh

eager beacon
#

so if you set all of the margins for both of the widgets to 0 it should look how it does in your screenshot

modern marsh
#

oh ok

#

also, i ran your xml file

#

it still gives the same sized window

#

i guess the problem is my screen resolution?

#

im on a 4k screen

eager beacon
#

no, I said I never set a fixed size on the main window because I didn't know how big you wanted it

#

so you need to do that

modern marsh
#

ohh

#

ok

#

oh nice it scales accordingly

#

wow

eager beacon
#

that's the magic of a layout

modern marsh
#

so , i make a frame inside a window

#

and then add layouts right?

#

or should the frame itself be in a layout

eager beacon
#

are you using designer?

modern marsh
#

yes

eager beacon
#

those red icons mean there is no layout for those items

modern marsh
#

ahh isee

#

i have done the same

eager beacon
#

so you really should make sure everything has a layout unless for some reason you plan to add a layout in python

modern marsh
#

except frame right?

#

also

#

suppose i want it to resize as it did in your xml

#

so should i add a global layout

eager beacon
#

Everything should have a layout

modern marsh
#

and then add mini layouts in it

#

oh

#

ok

eager beacon
#

you can set one by right clicking on the item without a layout

modern marsh
#

ahh nice

#

ok so i set a verticalLayout for the frame

#

and then put a horizontalLayout for the top buttons

#

inside it

#

but i cant resize it now

eager beacon
#

yeah that would be fine

#

What do you mean?

modern marsh
#

uhh

eager beacon
#

does everything have a layout?

modern marsh
#

yes

eager beacon
#

you added a layout from the side bar

modern marsh
#

uhh yes

#

is that a bad thing to do?

eager beacon
#

no not really

modern marsh
#

for frame, i right clicked and selected

eager beacon
#

now you have to set a fixed size policy on that widget

#

and min/max sizes on the buttons

#

then use a spacerItem to push them all over to the right hand side

modern marsh
eager beacon
#

on the grey thing thats holding the buttons

modern marsh
#

ahh so the layout

#

oh nvm

#

thats the frame

eager beacon
#

well if that isn't intended to be the button box you need to add a widget to the frame

#

and put the buttons in that widget

#

and do what i said just a second ago to get the sizes right

modern marsh
#

wait so i should make another frame for the buttons?

eager beacon
#

are they already inside one?

#

that looks like they are, or you have an hbox layout

modern marsh
#

they are inside the main frame

#

this

eager beacon
#

okay that isn't what you want

#

you want a vertical layout on the frame

#

then a widget with an hbox layout for your buttons

#

then put the button widget in the frame

#

and add the other stuff below the button widget

#

make sense?

modern marsh
#

ahh ok yeah

#

makes sense

#

just that in the real python site and docs too ig ,i saw the nesting of layouts

#

thanks :))

eager beacon
#

you can nest layouts, but its good to have separate the functions of your app, and widgets can help do that. In your specific case though nesting wouldn't work correctly since an hbox would add any new layout to the right of the last widget

#

so you could do something like vbox on the frame, hbox for the buttons in the frame vbox and a second below the button hbox

#

but generally that just means you end up needing to mess with setting more custom margins and its more difficult to use the break layout option to reconfigure the layout.

modern marsh
#

one problem now

#

the stylesheet border-radius attribute is not working for some reason

eager beacon
#

I set a min/max height/width of 18 i think

modern marsh
#

i put 16

eager beacon
#

if the rect height / width is less than border radius x2 you won't see an effect

#

you need to do it on both height and width

modern marsh
#

oh thats true

eager beacon
#

those clearly are still rectangles

modern marsh
#

ahh thanks :))

modern marsh
#

i could not find it anywhere

eager beacon
#

something someone made

#

its not a default widget

modern marsh
#

oh ok

eager beacon
#

you could do it with a paintEvent

#

its just 2 parallel lines with 2 arcs connecting the lines and an ellipse in the middle that moves to the other side of the rectangle when pressed

#

the most difficult part would be the animation to slow the movement of the ellipse when moving from one side to the other

#

you could use a QVariantAnimation for that

#

or a QTimeLine

modern marsh
#

so i make this all manually? or with Designer?

eager beacon
#

you'd have to program this.

modern marsh
#

so it will be a widget that i can import right?

#

into designer

eager beacon
#

I suppose you could create an imitation using a QSlider in designer

modern marsh
#

hmmm

eager beacon
#

its wouldn't be hard depending on your css skills

modern marsh
#

i know nothing about CSS ๐Ÿ˜„

#

but i do have thedocs

#

thanks for the info :)))

glass dagger
unique forge
#

DerpGurkan is typing...

modern marsh
#

when i set this - setWindowFlag(Qt.FramelessWindowHint) my window opens and disappears

#

heh

unique forge
#

ok

modern marsh
#

and yeah thats a bug

#

so

#

how do i fix it?

unique forge
#

did you self it?

modern marsh
#

ok so

#

i did -

unique forge
#

self.setWindowFlag(Qt.FramelessWindowHint)

#

try selfing everything

modern marsh
#

well i did self.login_ui.set.....

unique forge
#

just self it

modern marsh
#

login_ui being from loadUI()

unique forge
#

no need to do

#

self.ui

#

just self it

modern marsh
#

where should it be?

#

in the init or setupUI

unique forge
#

inside your def init

modern marsh
#

ahok

unique forge
#

__init__

#

not init

#

I learnt how to underline in discord today

modern marsh
#

well thats the thing

#

it does not work

#

because i want that attribute on the .ui file i loaded in

unique forge
#

yeah, so

#

self it

#

not self.ui

#

self

#

because its not for the Ui_MainWindow

#

its for your other class

#

whatever you named it

modern marsh
#

so you are saying that if i put the attribute to the global window , it applies to the windows loaded from ui file?

unique forge
#

yes

modern marsh
#

well i did that and it did not work

#

holup lemme send code

#
from PyQt5.QtWidgets import (
    QApplication,
    QMainWindow,
    QPushButton
)
from PyQt5.QtCore import Qt
from PyQt5 import uic
import sys


class Main(QMainWindow):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.setGeometry(500, 500, 700, 1400)
        self.setWindowFlag(Qt.FramelessWindowHint)
        self.setupUi()
        
    def setupUi(self):
        self.login_ui = uic.loadUi('login.ui')
        self.login_ui.show()

        # self.login_ui.pushButton_4.clicked.connect(self.login)
        # self.login_ui.setWindowFlag(Qt.FramelessWindowHint)
        self.login_ui.setAttribute(Qt.WA_TranslucentBackground)

    def login(self):
        self.login_ui.destroy()


def setup():
    app = QApplication(sys.argv)
    window = Main()
    sys.exit(app.exec_())


setup()```
unique forge
#

perfect

modern marsh
#

mhm it does not work

#

...

#

hmm wait lemme try something

#

ayy it worked

#

i put the attribute after showing the window

#

also , its self.login_ui.set.....

digital rose
#

threading is so hard for me ):

glass dagger
#

Hi

#

Anyone know how to make widget size increase as the text edit size increases?

#

On Pyqt5

#

So there is no scrollbar and there is enough space to see everything?

#

I want the textedit to resize to its contents to fit

digital rose
#

Tcl_AsyncDelete: async handler deleted by the wrong thread

#

whats this mean?

#

nvm

#

i get this now

#

self.textEdit.setText(
AttributeError: 'Thread' object has no attribute 'textEdit'

digital rose
#

just a simple listbox

unique forge
#

@glass dagger layouts

glass dagger
#

Hm?

unique forge
#

layouts

glass dagger
#

Wdym

unique forge
#

layouts

glass dagger
#

For the "problem" I was having?

unique forge
#

to set the size

#

adjust as the window size does

#

use layouts

glass dagger
#

No, what I meant was so that the TextEdit resizes

#

per the amount of content inside

#

so the scrollbar for it doesnt show up

unique forge
#

turn scroll bar off

glass dagger
#

No since then not the whole content would show

unique forge
#

you can promote a textedit

glass dagger
unique forge
#

to that

glass dagger
#

I already did it

#

But got an error so I downloaded it and instead of using pip I just used it directly into file

#

Since they use Pyqt and Im using pyside and now it works

digital rose
#
from tkinter import *
from population import *

def open_window():
    new_window = Toplevel(root)

    new_window.title("Choose Countries:")

    new_window.geometry("200x200")

    listb = Listbox(new_window)
    for country in countries_index:
        listb.insert(0, country)

    listb.pack()

    Label(new_window,
          text ="Country Selection").pack()

root = Tk()

root.geometry('450x450')

regions_btn = Button(root, text = 'Plot Regions', bd = '5', command = lambda : plot_regions())
top_btn = Button(root, text = 'Plot Top Countries', bd = '5', command = lambda : plot_top_countries())
slct_btn = Button(root, text = 'Plot Selected Countries', bd = '5', command = lambda : open_window())

regions_btn.pack(side = 'top')
top_btn.pack(side = 'top')
slct_btn.pack(side = 'top')

root.mainloop()
#

I am trying to create a ListBox that displays different countries. When the user selects a country, the country is added to a list. When the user deselects a country, the country is removed from the list. How do I implement this? I'm very lost.

leaden locust
#

I just started using PyQt5...
Do I have to download QT designer for designing?

modern marsh
#

not mandatory

#

its easier to design with the Designer

eager beacon
#

you don't need it, but you'll probably be able to get started quicker if you don't have any experience with Qt.

coarse dew
#

hey, does anyone know if i should llearn kivy? is it good for begginers, or should i start with something like tkinter and then kivy?

leaden locust
#

Yeah first try tkinter then kiv and then go for PyQt

eager beacon
#

I'd go straight for Kivy. tkinter has less than stellar documentation and that can cause you to get stuck for longer than you should be.

tacit iris
#

hey, super beginner here, is it possible to use python to create a gui that then fill an excel file ? I got a student job and at this place they use a computer with an open excel sheet as a checkout. It's long and boring when people pay because I have to write the type and sub type of item, the price, the amount, et weight, all that manually x) So I'm wondering if it is possible to easily make a GUI with like dynamic box for the type and subtype and that can calculate the price instead of me

#

and fill the excel sheet

tacit iris
#

I'm a total noob, just wondering if it's possible easily

modern marsh
#

do not use csv with excel , very frustrating to use

modern marsh
#

i have a problem in my code

#

so i made 2 ui files - login and base.ui

#

i open the login window first and it appears properly etc

#

but when i call the base window class , the window appears and disappears

#

!paste

#

ping pls :))

unique forge
#

self ity

#

self it

#

@modern marsh all you have to do is self.window.show

#

and it works!

modern marsh
#

alright i will try that

modern marsh
eager beacon
#

probably has something to do with not creating Base in __main__ but instead in login, then using destroy on login

modern marsh
#

oh

#

hmmm

modern marsh
#

and the window still behaves the same

eager beacon
#

If you want to zip your project files and send me a link I'll take a look when I get a chance

modern marsh
#

aight

mint swallow
#

I need help setting up my ubuntu to do graphical programming

lime warren
mint swallow
#

For programming, yes

#

@lime warren

gentle swallow
#

hi i have a problem with my tcp chat room it works fine on a local network but i cant get it to run outside my network

#

can you help me