#user-interfaces

1 messages ยท Page 74 of 1

digital rose
#

Yes, the learning curve is steep but you get to use all your 10 fingers for typing, no mouse needed.

tawdry mulch
#

๐Ÿ˜›

autumn badge
#

very true

tawdry mulch
#

Worth a try IG

autumn badge
#

i have tried vim. i respect it, but not a fan

digital rose
digital rose
autumn badge
#

i agree

#

but that means more time.......

digital rose
#

In any case, it's better to go with what you are best with.

autumn badge
#

maybe. between work and home life, i barely get time to do what i want.

#

i have a cnc router 60% built that has been sitting on my desk for months just waiting to be put together

tawdry mulch
#

gotta find time

digital rose
#

I guess this is getting off topic now ๐Ÿ˜…

tawdry mulch
#

I barely have time to manage both discord and stackoverflow too, and school works. It is just all a mess

tawdry mulch
autumn badge
#

trying. with a 10yo and a 1yo, time is a luxury i do not have.
But yea, we are off topic

#

so the best suggestions are pyqt or tkinter?

sudden coral
#

What are you trying to build?

#

There are more viable options for UI libraries.

autumn badge
#

the world
i was having issues when trying out remi, but found that was an IDE issue
Now i am just asking in general. basic desktop GUI apps.

#

whats your fav Mark?

sudden coral
#

I don't think it's fair to ask me that because I

#

have only properly tried Pyside (pretty much same as pyqt)

autumn badge
#

i would prefer pyside myself, but it always breaks when i install it

#

i dunno why. i just gave up

sudden coral
#

But I do like it. I think its biggest downsides are a steep learning curve and being fairly bulky since it's a very batteries-included type of library. That can have its benefits, but it isn't beneficial to simpler apps.

autumn badge
#

agreed. and it is almost like pyqt without the screwy licensing crap

sudden coral
#

Another downside is poor Python documentation, but that's steadily improving. Since the API very very closely follows the original C++ library, I just look at the C++ docs.

#

Some docs for Python still use C++ code examples, etc.

#

And there's a bigger community around the original C++ library, so you'd find more online resources for that.

autumn badge
#

i have dabled in pyqt, pyside, appjar, tkinter, pysimplegui, flask (poorly), pyforms, kivy, remi and a few others but am always on the hunt.
Its not that i dont like any of them or like one more than the other. I just like testing out different stuff to see if it offers something i didnt have before

sudden coral
#

Yeah, that's the best approach. Some libs do things quite differently (Kivy comes to mind), which is really divisive.

autumn badge
#

kivy is interesting. i will give it that

sudden coral
#

I think Qt has something sort of similar with QtQuick. In fact, some users complain that the direction of development is far too focused on QtQuick these days.

autumn badge
#

if a portable python could be made to make pyinstaller files smaller and faster, life would be good

#

off topic a bit but my desktop apps need to be "compiled" so i try to get some lightweight UI frameworks

sudden coral
#

As much as I do like Python, I think I would look to other languages for desktop GUI app development

autumn badge
#

the apps i have written for work

sudden coral
tawdry mulch
autumn badge
#

that work with C# then @sudden coral

#

?

autumn badge
sudden coral
#

Yeah.

#

I'd be fine with Python for some simpler apps though.

#

Depends on the scope and scale of the project.

autumn badge
#

i have been dabbling in C#. lots of new libs to learn

sudden coral
#

Packaging and distributing Python nicely is indeed an issue for Desktop apps.

paper vigil
#

How

tawdry mulch
paper vigil
#

yeah

autumn badge
#

and my IT dept at work will not let me have everyone install python on their computers

paper vigil
#

that looks so cool

autumn badge
#

if i could, life would be simple

tawdry mulch
#

What is their excuse

tawdry mulch
paper vigil
autumn badge
tawdry mulch
autumn badge
#

im sure there was a vulnerability at one point at some time in the past on one of the versions, so they must all be bad

#

i will say, my IT dept is not the smartest. i got one guy who fights for me and is knowledgeable, but he aint the manager

sudden coral
#

It's probably just a lack of motivation to invest time to look into giving it security clearance. Also, any additional 3rd party app increases the attack surface of the machines.

autumn badge
#

i even considered java because of the swing lib, but i found out the IT dept removed java from all of the computers

autumn badge
versed vessel
#

Hello, so my UI looks like this:

#

How can i center on the top of the screen the random letter (scramble) and the timer on the actual center of the screen?

tawdry mulch
#

How do you place the widgets

versed vessel
#

Scramble

        self.scramble = Label(self.app, text=self.scramble_output, bg = '#232931', fg = 'white', font =('Overpass Mono Light', 12), anchor = NW)

Timer (display)

        self.display = Label(self.app, text='0.00', bg = '#232931', fg = 'white', font = ('DS-DIGITAL', 64), pady=100)
tawdry mulch
#

I meant, grid or pack or place

versed vessel
#

Oh, grid

tawdry mulch
#

show that code please

versed vessel
#
self.display.grid(row=1, column=0)
        self.start_button.grid(row = 2, column=0)
        self.scramble.grid(row=0, column = 0)
tawdry mulch
#

Is there column 2? anywhere

versed vessel
#

No

tawdry mulch
#

Ok then try adding sticky='ew'

versed vessel
#

In all of them?

tawdry mulch
#

Yeah

versed vessel
#

K

tawdry mulch
#

Hah the window is made big by dimensions

#

Are there just 3 widgets ALWAYS?

versed vessel
#

For now yes

#

The thing is

#

Ok hold on

tawdry mulch
#

pack() would give you directly

#

Give the code, let me see

versed vessel
#

This is how it looks without maximizing it

#

800x500

tawdry mulch
#

Can you give the code

versed vessel
#

And this is what im trying to make

versed vessel
tawdry mulch
versed vessel
versed vessel
tawdry mulch
#

Well tkinter apps are not responsive by default

versed vessel
#

So i have to code how the UI looks when maximized?

tawdry mulch
#

That would make sense too.

#

Maybe @digital rose knows any better way

#

Basically you could use something like root.grid_columnconfigure(0,weight=1) @versed vessel

versed vessel
#

What does weight does?

tawdry mulch
#

Basically makes it like responsive, but that is not what you exactly want here

versed vessel
#

Ok, Imma focus first that the UI works on 800x500

#

Then I'll make it responsive

#

Or should i make it responsive instantly?

tawdry mulch
#

Responsive is not the best idea with tkinter. I usually just make my windows non resizable

#

I think the app looks cute, in small dimension ๐Ÿ˜›

versed vessel
#

Alright alright

#

How can i make it non resizable?

rain jetty
versed vessel
#

Yeah but i googled it already

rain jetty
#

cool

versed vessel
#

root.resizable(False, False)

rain jetty
#

or 0, 0 but yeah

versed vessel
#

Ok

versed vessel
#

I found a way to initialize my window as maximized

tawdry mulch
versed vessel
#

root.state('zoomed')

tawdry mulch
versed vessel
#

Looks good, but it hides the taskbar

versed vessel
#

But it hides the taskbar

tawdry mulch
#

Try root.attributes("-fullscreen", 1) @versed vessel

#

Both should look some IG

versed vessel
#

It opens it as fullscreen

tawdry mulch
versed vessel
#

No taskbar

#

Don't see why you would need the taskbar

#

Guess I'll leave it like that

tawdry mulch
#

Hmmmm whatever suits you

versed vessel
#

I'll leave it like that

#

When i get to post the timer, I'll ask for feedback if i rather choose 800x500, fullscreen or leave it as it is

hoary venture
#

hello i am trying to put a messagebox.showwarning if there is no value entered

#

but it does not work

#

can someone help?

tawdry mulch
#

Show the code @hoary venture

hoary venture
#
print(
from tkinter import*
def calculate_due():
    intxt = float(Amount_Entry.get())  
    txt=float(Tax_Entry.get())
    if intxt !="":
        Totaldue= round(intxt*(txt/100),2)
       
        Due_Entry = Label(window,text=Totaldue, fg = "black", bg = "white", font = "Calibri")
        Due_Entry.place(x=150, y=120)   
    else:
        messagebox.showwarning(" Stop!","Please enter a value")
        return
   
    
window=Tk()

window.title("Windows TaxApp")
window.configure(bg="black")
window.geometry("300x200")
Total=StringVar()
Percent=StringVar()


lbl1=Label(window,text="TAX CALCULATOR",fg="white",bg="black",font="bold")
lbl1.place(x=80,y=5)

lbl2= Label(window, text="Total Amount:       $",fg="white",bg="black",font="Calibri")
lbl2.place(x=25,y=40)

Amount_Entry= Entry(window,textvariable=Total)
Amount_Entry.place(x=160,y=40,width=50)

lbl3= Label(window,text="Tax Percentage: ",fg="white",bg="black",font="Calibri")
lbl3.place(x=25,y=80)

Tax_Entry= Entry(window,textvariable="Percent")
Tax_Entry.place(x=150,y=80,width=50)

lbl4= Label(window,text="Total Due: ",fg="white",bg="black",font="Calibri")
lbl4.place(x=25,y=120)

# Due_Entry= Label (window)
# Due_Entry.place(x=150,y=120,width=70)

btn1= Button(window,text="COMPUTE",bg="white",fg="black",command= calculate_due)
btn1.place(x=100,y=160)

window.mainloop()
tawdry mulch
#

You should understand that if the boxes are empty float() will give an error @hoary venture

#

So you should put that inside the if.

hoary venture
#

ok

tawdry mulch
#

did u get it?

hoary venture
#

it says intxt is not defined

tawdry mulch
#

Use if Amount_Entry.get()!="": then

hoary venture
#

oh nvm i got it

#

thankyou so much ๐Ÿ˜€

tawdry mulch
#

At the end it should look like: @hoary venture

def calculate_due():
    if Amount_Entry.get() !="":
        intxt = float(Amount_Entry.get())  
        txt=float(Tax_Entry.get())
        Totaldue= round(intxt*(txt/100),2)
       
        Due_Entry = Label(window,text=Totaldue, fg = "black", bg = "white", font = "Calibri")
        Due_Entry.place(x=150, y=120)   
    else:
        messagebox.showwarning(" Stop!","Please enter a value")
versed vessel
#

For example on my timer, the time, is called display, the algorithm to scrable the cube is called scramble, the Running... text is called state

tawdry mulch
#

Name it the purpose they serve

versed vessel
#

Ok ok

stable folio
#

Hello, any idea how to make a timeline using PyQt, like the one in the picture, thanks.

eager beacon
#

I'd think the best way to do something like that would be to use QGraphicsView/Items to build the tick line, track area, and the slider.

#

The controls in the bar at the top could be part of the widget holding the view or create a toolbar in the scene

mental gyro
#

hey, im planning on building a cryptocurrency (full nodes written in Python) but have mobile and desktop apps for making transactions

if there a way i can have the app without going via apple app store?

#

i dont wanna have to do go via apple dev stuff (getting it accepted onto the app store)

#

and also dont wannna pay alot of money to be an apple developer

#

because its just a project for me and a smallish group of friends/classmates to use at school. im not gonna make any money out of it, so it'll just be a huge money pit

digital rose
versed vessel
digital rose
#

hi, i'm trying to compile a script from python to exe using pyinstaller, i've already compiled some stuff whit it but now i want to compile a gui software, i'm using pygubu for ui objects but when i compile the code and execute i get py ModuleNotFoundError: No module named 'pygubu.builder.tkstdwidgets'executing the code from idle works whit no problems, what i'm missing?

#

ping me to call my attention.

digital rose
#

I read a bit about your problem yesterday.

digital rose
#

I found this thing on reddit

#

And it is SICK

modern marsh
#

indeed it is

tawdry mulch
versed vessel
worthy ridge
#

@stable folio extend labeland use a painter to paint in a scrolling pattern

scenic hornet
#

why do i get none type as return

#

when it should be actually stream

#

tkinter*

hollow drum
#

how to get a permission to speak in voice chat?

scenic hornet
hollow drum
#

???????????????????????????????????

lime monolith
plain elk
#

Not, like that at least. That's how you get banned :P

scenic hornet
#

sry im a beginner in tkinter so :P

raven orchid
#

Test

scenic hornet
#

what

lime monolith
scenic hornet
#

okay

scenic hornet
scenic hornet
#

ok now its only downloading in 360p

#

no other quality is moving on

lime monolith
scenic hornet
versed vessel
#

Any idea of how to make a side panel on tkinter?

#

self.sidepanel = Frame(self.app, bg = 'red', width = 200, height = 800) I created a frame and put it on the first column of the app

#

self.sidepanel.grid(row=1, column=0, sticky=NW)

lime monolith
versed vessel
#

But i don't know why it moves my other widgets out of the screen

scenic hornet
#

aah

hybrid spindle
#

if you manually increase/decrease a pyqt window is there a way to get the geometry of that window to dynamically adjust button locations?

#
class mainWindow(QtWidgets.QTabWidget):
    def __init__(self,Abs, parent=None):
      #doing stuff


if __name__ == "__main__":
    import sys
    
    app = QtWidgets.QApplication(sys.argv)
    main = mainWindow(Abs)
    main.resize(1400,900)
    
    main.show()
    sys.exit(app.exec_())

I cant locate where the geometry is stored within "mainWindow"

versed vessel
#

Should i center stuff panning them?

worthy ridge
#

@hybrid spindle u need to actually use layouts they suto scale

hybrid spindle
worthy ridge
#

Qt designer is usef

#

Ui isnt coded

hybrid spindle
modern marsh
#

use QDialog or QMainWindow or QWidget

versed vessel
#

Ok so i got this code right now, which basically tells the timer is running.

def start(self):
        # Unshow last time or starting time
        self.display.grid_remove()

        # Start counting time
        self.start_time = timer.start()

        # Create widgets to show the timer is running and finish butto
        self.state = Label(self.app, text='Running...', bg='#232931',
                           fg='white', font=('Overpass Mono Light', 32))
        self.state.grid(row=1, column=1, sticky = EW, padx=560, pady=300)
        self.finish_button = Button(
            self.app, text='FINISH', fg='white', bg='#4ecca3', command=self.finish)
        self.finish_button.grid(row=2, column=1, columnspan=2, padx=275, sticky=N, ipadx=20)

        # Unshow start button and scramble widgets
        self.start_button.grid_remove()
        self.scramble.grid_remove()

What can i do so i can show the current time and not Running...?

#

What I thinked about is a while loop but I guess that's not the correct aproach

#

Basically im trying to find a way to update state to the current time - self.start_time without stopping/messing the whole code

lime monolith
teal shard
#

Not sure where to ask this....Does anyone know any nice augmented reality libraries for Android?

tawdry mulch
versed vessel
#

How can i make so when i hit the spacebar my app detects if i hitted a button?

versed vessel
versed vessel
# tawdry mulch `bind`

self.start_button.bind('<Key>', self.spacebar)

And my spacebar func is:

def spacebar(self, event):
        print('Clicked' + event.char)
#

But nothing happens

tawdry mulch
#

buttons wont have focus by default. Only if it has focus, it can read those binds

versed vessel
#

Ohhh

tawdry mulch
#

I would say root.bind('<Key>', self.spacebar).

versed vessel
#

So my mouse has to be on top of the button?

tawdry mulch
#

No, your focus has to be on the button

versed vessel
tawdry mulch
#

Press tab and u will see a highligting around widgets, that has to be on the button

versed vessel
#

So when one function runs, unbind it from the one it just ran and bind it to the next one, that's my guess

tawdry mulch
#

Seems like a XY problem

#

The XY problem is a communication problem encountered in help desk and similar situations in which the person asking for help obscures the real issue, X, because instead of asking directly about issue X, they ask how to solve a secondary issue, Y, which they believe will allow them to resolve issue X.
However, resolving issue Y often does not r...

versed vessel
#

Lol

#

Alright, let me get the first thing working

tawdry mulch
#

So what is your main aim here

versed vessel
#

When i hit spacebar, my timer should start counting the time, when i hit spacebar again, it should stop

tawdry mulch
#

Okay, use a flag then

versed vessel
#

flag?

tawdry mulch
#

Hmmm let me try to give you an example

versed vessel
#

OK

tawdry mulch
#

Mmmm seems like it is taking more time than usual. I am not in my senses :p @versed vessel

versed vessel
#

Lol, no worries

tawdry mulch
versed vessel
#

Probably you need some rest, who knows

lime monolith
# versed vessel When i hit spacebar, my timer should start counting the time, when i hit spaceba...
import time
import tkinter as tk


class App(tk.Tk):
    def __init__(self):
        super().__init__()
        self.time_label = tk.Label(self)
        self.time_label.pack()
        self._update_timer = True
        self.timer()
        self.bind('<space>', self.on_space)

    def timer(self):
        if self._update_timer:
           self.time_label.configure(text=time.strftime("%H:%M:%S"))
        self.after(1000, self.timer)

    def on_space(self, event):
        self._update_timer = not self._update_timer


if __name__ == '__main__':
    app = App()
    app.mainloop()```
tawdry mulch
#

I've dont this before but not using after(). Multiple calls to after will repeat the function at a faster rate

tawdry mulch
#

So procedural example would be:

from tkinter import *

root = Tk()

time = 0
started = False # This is a flag
def start_timer():
    global time, started, rep
    if not started:
        time += 1
        lbl.config(text=time)
    root.after(1000,start_timer)


def stop(e):
    global started
    started = not started

lbl = Label(root,font=('',20))
lbl.pack()

root.bind('<space>',stop)
start_timer()

root.mainloop()
versed vessel
#

how would that be if um using classes?

lime monolith
tawdry mulch
tawdry mulch
versed vessel
#

I've tried using it on classes:

class Application():
    def __init__(self, app):
        self.app = app
        self.started = False
        #More stuff

def start(self):
        self.started = True
        if self.started == True:

            # Unshow last time or starting time
            self.display.grid_remove()
            #has_finished = False

            # Start counting time
            self.start_time = timer.start()

            # Create widgets to show the timer is running and finish button
            self.state = Label(self.app, text='.', bg='#232931',
                            fg='white', font=('DS-DIGITAL', 32))
            self.state.grid(row=1, column=1, sticky=EW, padx=560, pady=300)
            self.finish_button = Button(
                self.app, text='FINISH', fg='white', bg='#4ecca3', command=self.finish)
            self.finish_button.grid(
                row=2, column=1, columnspan=2, padx=275, sticky=N, ipadx=20)

            # Unshow start button and scramble widgets

            self.start_button.grid_remove()
            self.scramble.grid_remove()
            self.app.after(1000, start)

        # Make so timer updates elapsed time
        #timer.update_time(self.start_time, self.state, self.app)
tawdry mulch
#

create another method called updater and then assign the oppt of whatever is self.start.

versed vessel
#

wrong that it would not run or that is not supossed to be indented like that?

#

I dont usually indent like that autopep8 does

tawdry mulch
#
def updater(self,e):
    self.start = not self.start
tawdry mulch
#

Well both the example here assumes that the timer starts from first. I think you want the timer to start only when pressed spacebar right. @versed vessel

versed vessel
#

Yes

#

On start, what should happen (for now) is to put on on screen a scramble and the time at 0.00 and the start button

tawdry mulch
#

I am out of ideas, and very sleepy. Perhaps @lime monolith can help now

versed vessel
tawdry mulch
tawdry mulch
versed vessel
#

Ok ok

#

And whenever updater runs just make self.started = False

#

And on def start(self): should i make a while loop?

tawdry mulch
#

This whole concept would work, but after running twice is not going to help.

versed vessel
versed vessel
#

Im kinda blocked tbh

tawdry mulch
versed vessel
tawdry mulch
#

No errors would come, its simple not possible

#
from tkinter import *

root = Tk()

l = Label(root,text='Hi',font=('',20))
for i in range(100):
    l.grid(row=i,column=0)

root.mainloop()
#

l is not created 100 times

#

one widget can only be placed once

versed vessel
#

Ok

tawdry mulch
#

If you want, move l inside the loop and see

versed vessel
#

So back again what i was trying to do, i got my bind set to updater, which makes self.started = False and in start class, it makes self.started = True

tawdry mulch
#

In __init__ call self.start().

versed vessel
#

But that would start the timer at inizialization

#

Or am i wrong?

tawdry mulch
#

I know. That is the problem with this method.

versed vessel
#

So I have to find another way

tawdry mulch
#

Ya... Better to ask in stackoverflow

versed vessel
#

Haven't used it ๐Ÿ˜… how should i make my question?

tawdry mulch
#

If you want to recieve a proper answer, then show them what you have done so far

#

otherwise, all its gonna get is downvotes

versed vessel
#

Ok

tawdry mulch
#

Link it here once your done too, maybe Ill try to get some help @versed vessel

versed vessel
#

Ok ok

versed vessel
#

Ok before posting anything

#

I managed it to work

#

But not correctly

tawdry mulch
versed vessel
#

On __init__ i putted this

#Bind spacebar to start timer
        self.app.bind('<Key>', self.updater_start)

And created 2 functions.

def updater_start(self, e):  
        if e.keysym=='space':
            print('Hitted spacebar')
            self.start()

    def updater_stop(self, e):
        if e.keysym=='space':
            print('Hitted spacebar')
            self.finish()
#

The problem is the time starts and stops and for some reason the elapsed time adds to the last time

versed vessel
#

I deleted them

tawdry mulch
#

? after()?

#

Then how does the time increase

versed vessel
#

when timer starts, i save a time.time() variable, when it finishes, it subtract the current time from the time.time variable and that its the elapsed time

tawdry mulch
#

Oh, I see

#

Then maybe send your entire code, let me see

versed vessel
#
def finish(start_time):
    # Calculate elapsed time and round it
    output = time.time() - start_time
    output = round(output, 2)

    # Check if its neccessary to format time with hours and minutes

    if output > 60:
        mins = round(output // 60)
        sec = round(output % 60, 2)
        hours = round(mins // 60, 2)

        # Format as minutes
        if mins >= 1 and hours < 0:

            # Format time as minutes:seconds and return it
            message = f'{mins}:{sec}'
            return message

        # Format as hours
        elif hours >= 1:
            # Format time as hours:minutes:seconds and display message
            message = f'{hours}:{mins}:{sec}'
            return message

    else:
        # Return just the seconds, there are no minutes or hours to format.
        return output

I got this code on another file

versed vessel
#

Oof im dumb that's not the one

tawdry mulch
#

Hmmmm, hopefully someone can help you soon

versed vessel
#

Yeah, I'll post this problem now.

tawdry mulch
versed vessel
#

It did worked

#

I changed some code but in general its the same

tawdry mulch
versed vessel
#
#My version
def space_press(self, e):
        if e.keysym=='space':
            if self.space_presses == 0:
                self.space_presses += 1
                self.start()
            else:
                self.finish()
                self.space_presses = 0
        else:
            pass
tawdry mulch
versed vessel
#

Not really, guess its easier with 0 and 1

tawdry mulch
versed vessel
#

Or is it more helpful with even and odd?

tawdry mulch
#

In the comments ask acw for an example of what he meant, he usually makes good point.

tawdry mulch
#

In the question one about resetting

versed vessel
#

Ok ok

worthy ridge
#

PAGE - Python Automatic GUI Generator

#

Chech this out for tk designer

digital rose
#

Hello

tawdry mulch
digital rose
#

Thank you

fresh raptor
#

hello, i want to make an gui for my application that can be access via web. but i'm never do this before. any good suggestion?

tawdry mulch
#

GUI is a desktop application. What do you mean "that can be access via web"? @fresh raptor

fresh raptor
#

via browser. the app main target is to installed on vps.

tawdry mulch
#

Idk, try Remi python @fresh raptor

fresh raptor
#

ohh god. thanks, this is what i'm looking for

tawdry mulch
lime monolith
versed vessel
#

To update the time

#
def update_time(self):
        if self.timer_running:
            #Format elapsed time
            output = timer.finish(self.start_time)
            self.state.configure(text=output)
            self.app.after(1, self.update_time)

Did some small changes but it does work!

lime monolith
tawdry mulch
#

isnt there a feature in cube timers to have yellow flag ? @versed vessel

versed vessel
stray jackal
#

what the hell is JSON really ?

tawdry mulch
#

Just like cube timers

versed vessel
#

I just added that

#

I asked my cubing friends if they could try it but when they download it, it triggers a false positive

#

A virus

autumn badge
#

@sudden coral hey, can you DM me that C# GUI module you told me about a few days ago when you have a chance?

sudden coral
#

Maui

autumn badge
#

thank you sir

#

gonna try to remake one of my simple python apps in C# and see how the performance difference is

#

it doesnt look like it is officially released yet

warm sinew
warm sinew
# warm sinew

I need code for SignUp page with python TKinter
Sort of User registration page, Could someone able to code the above instructions for a simple registration form using python tKinter?

warm sinew
eager beacon
#

we're not going to write the code for you.

modern marsh
#

lol

plush stream
warm sinew
warm sinew
digital rose
#

This is annoying to fix, so either decrease wx.Bitmap() size. I have trouble figuring that out. I can also stop using wx.Frame.CreateToolBar since I can't figure out to resize it and make wx.Toolbar class myself where I specify the size

digital rose
#

Resized the images with PIL and now it's fine

digital rose
spare badge
#

So, I'm trying to use tkinter on pycharm

#

and it's not available in packages

#

I've tried installing it with 'sudo apt install python3-tkinter' and it doesn't show up in pycharm

lime monolith
wet bough
# warm sinew

Is it normal to plan this much before doing the stuff?

trail stirrup
#

Hi everyone! Im trying to make a gui for my simple python program that calculates the least amount of coins to give a user based on the amount. I would greatly appreciate the any help or advice!

hybrid spindle
#

Anyone have any thoughts on how to condense this?

if event.inaxes is not None and ((event.inaxes in self.axesL[0]) or (event.inaxes in self.axesL[1])):

I can have up to 5 axes. It'd be one hell of a line to continue repeating the event.inaxes in self.Laxes[X]

rain jetty
#

wow

paper torrent
#

Help How DO GUI?

#

thanku

eager beacon
#

Maybe you could be more specific

paper torrent
#

How to make Gui for a python program. Like lets say you have a print func, how do you make gui that has the print func on it?

#

Sorry for my very vague question ๐Ÿ‘

eager beacon
#
def printer(text):
    return text

if __name__ == '__main__':
    from PySide2.QtWidgets import QApplication, QLabel
    app = QApplication()
    label_text = printer('Some text from a function')
    l = QLabel(label_text)
    l.show()
    app.exit(app.exec_())
fleet lynx
#

Hey, I'm just getting into GUIs and I know that tkinter is the buitin GUI library but also I've heard that tkinter wasn't made to work with the oop structure of python. Is there a good and easy alternative?

lime monolith
# paper torrent Sorry for my very vague question ๐Ÿ‘

A tkinter example

import tkinter as tk


class Printer(tk.Tk):
    def __init__(self, *args, **kwargs) -> None:
        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)

    def on_button(self):
        print(f'Entry contains: {self.entry.get()}')


if __name__ == '__main__':
    app = Printer()
    app.mainloop()```
lime monolith
# paper torrent Sorry for my very vague question ๐Ÿ‘

A WxPython example

import wx


class Printer(wx.Frame):
    def __init__(self, *args, **kwargs) -> None:
        super().__init__(*args, **kwargs)
        panel = wx.Panel(self)
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.entry = wx.TextCtrl(panel)
        sizer.Add(self.entry, flag=wx.ALL, border=5)
        self.button = wx.Button(panel, label='Print')
        sizer.Add(self.button, flag=wx.LEFT | wx.RIGHT |
                  wx.BOTTOM | wx.ALIGN_CENTER, border=5)
        self.button.Bind(wx.EVT_BUTTON, self.on_button)
        panel.SetSizer(sizer)
        sizer.Fit(self)
        self.Show()

    def on_button(self, event):
        print(f'Entry contains: {self.entry.GetValue()}')


if __name__ == '__main__':
    app = wx.App()
    Printer(None)
    app.MainLoop()```
paper torrent
#

oh wow thanks

lime monolith
eager beacon
#

this always use classes if you're building an app

meager spoke
#

In PySide6 Status bar becomes invincible if we disable Maximize button and show it in maximized form. How to solve this issue?

eager beacon
#

do you have code that can reproduce the issue?

worthy ridge
#

@meager spoke show the UI i=like in images

meager spoke
# eager beacon do you have code that can reproduce the issue?
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QMainWindow, QWidget, QGridLayout, QStatusBar


class Base(QMainWindow):

    def __init__(self):
        super(Base, self).__init__()
        self.__main_widget = QWidget(parent=self)
        self.__main_layout = QGridLayout(self.__main_widget)
        self.__status_bar = QStatusBar(self)
        self.__setup()

    def __setup(self):
        self.__setup_main_layout()
        self.__setup_main_widget()
        self.__setup_status_bar()
        self.__setup_base()

    def __setup_base(self):
        self.setObjectName("base")
        self.setWindowFlags(Qt.WindowMinimizeButtonHint | Qt.WindowCloseButtonHint)
        self.showMaximized()

    def __setup_main_widget(self):
        self.__main_widget.setObjectName('main_widget')
        self.setCentralWidget(self.__main_widget)

    def __setup_main_layout(self):
        self.__main_layout.setObjectName('main_layout')

    def __setup_status_bar(self):
        self.__status_bar.setObjectName('status_bar')
        self.__status_bar.showMessage("Testing 123")

worthy ridge
#

@meager spoke its better to use designer because u never code the UI Patt

meager spoke
worthy ridge
#

@meager spoke lol nope

#

@meager spoke the UI code isnt worked on in puthon its mostly worked on in designer

eager beacon
#

So what are you doing to affect the status bar?

meager spoke
meager spoke
eager beacon
#

What are you trying to do with the status bar anyhow?

#

I can't reproduce on mac btw. maximize button is never disabled

meager spoke
meager spoke
eager beacon
#

okay.. so how are you disabling the maximize button?

meager spoke
worthy ridge
#

@meager spoke show ur UI

#

not code

eager beacon
#

okay well the maximize button is working for me is what I meant

#

Is this the code you're running exactly?

#

because this isn't how you use a status bar

worthy ridge
#

@eager beacon moslty UI ineed to be filled to see the status bar

meager spoke
worthy ridge
#

show ur UI dude

meager spoke
#

@eager beacon

eager beacon
#

I'm not sure what you expect to be able to tell from looking at the UI that you can't from the code

#
self.__status_bar = QStatusBar()
self.setStatusBar(self.__status_bar)
meager spoke
#

@eager beacon

#

@eager beacon check in this two pics if maximize button is not disabled it show status bar

eager beacon
#

set your status bar properly and tell me if it still happens

meager spoke
worthy ridge
#

@meager spoke

#

shows up

meager spoke
worthy ridge
#
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'C:/Users/AppData/Local/Temp/designervlgcnY.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#

# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_MainWindow(QtWidgets.QMainWindow):

    def __init__(self) -> None:
        super().__init__()
        self.setupUi()

    def setupUi(self):
        self.setObjectName("self")
        self.resize(800, 600)
        self.centralwidget = QtWidgets.QWidget(self)
        self.centralwidget.setObjectName("centralwidget")
        self.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(self)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 21))
        self.menubar.setObjectName("menubar")
        self.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(self)
        self.statusbar.setObjectName("statusbar")
        self.setStatusBar(self.statusbar)
        self.statusbar.setStyleSheet("background-color: blue")
        self.setStyleSheet("background-color: black")


        self.setObjectName("base")
        self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint | QtCore.Qt.WindowCloseButtonHint)
        self.showMaximized()

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

    def retranslateUi(self):
        _translate = QtCore.QCoreApplication.translate
        self.setWindowTitle(_translate("MainWindow", "MainWindow"))

APP = QtWidgets.QApplication([])
APP.setStyle("Fusion")
INST = Ui_MainWindow()
INST.show()
APP.exec()
meager spoke
worthy ridge
#

show UI

meager spoke
#

@worthy ridge

#

i think it is problem with PySide6

worthy ridge
#

i dont have any idea about that bug

#

try checkin the ui using the Alt tab view

#

somwtimes windows maxes out of bounds

meager spoke
worthy ridge
#

idk about that i mostly use bothe buttons and just go eith 800, 600 size

mental gyro
trail stirrup
#

I need help with my Python Tkinter program Can I post it here?

lime monolith
trail stirrup
#

I am trying to build a Tkinter GUI for my code that returns the least amount of coins needed given an
amount. I used a lambda function for my code because I know you cant pass arguments with Tkinter.

Here is the error Im getting:

NameError: name 'stack' is not defined```
#

Here is my code

proven basinBOT
#

Hey @trail stirrup!

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

lime monolith
versed vessel
#

Should i use place() or grid()

violet palm
#

Can anyone help me .....
I want to append and show the txt file data in tkinter .....I tried it but when I append the show the data the loop again start from the zero and shows the previous data with add on of new line which cause the redundacy of data instead of just showing the last line by the keeping the old data same

#

Like:-
A

A
B

A
B
C

#

But I want it like :-
A
B
C

violet palm
versed vessel
#

K

shrewd raven
#

anyone know a good tutorial for QSyntaxHighligher in PyQt5? I dont want anything that uses the qt editor, just pure python

#

been having a lot of difficulty over the past few weeks finding any information, I only recently discovered this class existed when trawling through the docs and library files

shrewd raven
#

i found that one aswell, unfortunately pyqt5 changed a lot of things and this code throws me error after error once I try to implement it into my pyqt5 project

versed vessel
#

Is there a way I can put a widget anywhere i want without moving the rest of the widgets?

#

I padded this entry on y, and my side panel moved along with it

indigo crane
#

anyhow can i get font ligatures working in tkinter

#

sorry for asking this question BlobNotLikeThis

digital rose
#

although place would be good if u want a certain object to be at the exact place

placid nebula
#

hey all
i got problem with tkinter, i have 3 buttons, each clicked button have 3 variables for example a =1, b =0, c = 0, when second is clicked it changes a = 0, b=1,c=0 etc.
however i have other button which calls function with if statment checks if a = 1 , hwoever i get error
if a = 1:
^
SyntaxError: invalid syntax
where is problem?

tribal path
#

==

placid nebula
#

wth hahah

#

how i could not see it...

devout grove
#

How can I make a simple, square based but appealing tkinter interface

digital rose
#

Basically, I have a couple of QMainWindows in my program and all of them are defined in one python file in the following lines of code

#
if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Registration = QtWidgets.QMainWindow()
    Registration_ui = Ui_Registration()
    Registration_ui.setupUi(Registration)
    AlterMenu_2 = QtWidgets.QMainWindow()
    ui = Ui_AlterMenu_2()
    ui.setupUi(AlterMenu_2)
    StaffAddition = QtWidgets.QMainWindow()
    StaffAddition_ui = Ui_StaffAddition()
    StaffAddition_ui.setupUi(StaffAddition)
    ViewStaff = QtWidgets.QMainWindow()
    ViewStaff_ui = Ui_ViewStaff()
    ViewStaff_ui.setupUi(ViewStaff)
    MenuPage = QtWidgets.QMainWindow()
    MenuPage_ui = Ui_MenuPage()
    MenuPage_ui.setupUi(MenuPage)
    OrderManagement = QtWidgets.QMainWindow()
    OrderManagement_ui = Ui_OrderManagement()
    OrderManagement_ui.setupUi(OrderManagement)
    Login = QtWidgets.QMainWindow()
    Login_ui = Ui_Login()
    Login_ui.setupUi(Login)
    Login.show()
    sys.exit(app.exec_())
#

But in this code segment only the Login page is set to be shown

#
         self.window = QtWidgets.QMainWindow()
         self.ui = Ui_ViewStaff()
         self.ui.setupUi(self.window)
         self.window.show()
         Login.hide()```
and this is what happens when a button is clicked on the login page, it hides the login page and moves on to the ViewStaff page

        ```py
        self.window = QtWidgets.QMainWindow()
        self.ui = Ui_Login()
        self.ui.setupUi(self.window)
        self.window.show()
        ViewStaff.hide()```
and this is what happens when a button is clicked on the ViewStaff page, it opens up the login page again
but this time the ViewStaff page does not get hidden
#

PyQt

#

interesting

worthy ridge
#

@digital rose if u can explain ur problem more vividly i can give u a better approach because by my knowledge its not proper

digital rose
#

so they weren't getting hidden because the lines of code to hide them would have to be something like self.self.window.hide()

#

So I changed it all the format FirstWindow.show(), secondwindow.hide()

digital rose
digital rose
worthy ridge
digital rose
#

for example

#

Yeah that's probably a better approach

#

but I'm already way too into this way of doing it to restructure everything

#

fortunately I found a way to make it all work out so it's all good

worthy ridge
#

im restructuring the 4 time

digital rose
#

Lol damn

worthy ridge
#

@digital rose gets better each time

digital rose
#

Hello people, I'm adapting my script to use a PYQT interface. What's the really best way to use threading to separate interface and code? QApplication.processEvents() is a quick and dirty (and inefficient) way to do it, and I'm struggling to pass arguments with QRunnable... I don't need a full answer just some guidance. Also a good part of guides are outdated ๐Ÿ˜ฆ

plush stream
#

There's another way to create a worker class to avoid freezing gui using QThread

digital rose
#

Thanks ! I'll check it out

fading basin
versed vessel
#

Because i dont think my elements would be moving around

versed vessel
#

Hey there so i want that when i click a button, my UI should show a text saying "Attempting to connect to the server" and then connect, and if it fails, show an error box. But the text appears when the error box appears.

Code:

 # Remove widgets from screen and disable and enable buttons.
        self.app.unbind('<KeyRelease>')
        self.scramble.place_forget()
        self.display.place_forget()
        self.duels_button.configure(state=DISABLED)

        self.timer_button.configure(state=NORMAL)

        # Show waiting for connection

        self.conn_attempt = Label(self.app, text = 'Attempting to connect to the server...', fg='white', bg = self.window_background, font=('Oversized Mono Light', 18, 'bold'))
        self.conn_attempt.place(x = 650, y = 250)

        #Set up connection to server

        time.sleep(15)
        try:
            self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
            self.sock.connect((self.host, self.port))

        except:
            print('Couldn\'t connect to the server.')
            self.show_alertbox('servererr')
lime monolith
versed vessel
#

Still only shows after the error message is shown

lime monolith
versed vessel
#

Ok ok so I should only show the alert box if the exception is related that it couldnโ€™t connect to the server

lime monolith
# versed vessel Still only shows after the error message is shown

The connecting is probably also blocking the GUI loop so would have to be done in a separate thread.
https://python-forum.io/thread-17843.html

lime monolith
versed vessel
#

K k

digital rose
#

Hi! I'm working on a tkinter start up screen, and I would like one button to be green and say start, and one to be red and say quit
I have the red one working but how do I create green one as well?

import time
from tkinter import *
from tkinter.ttk import *
# Create Root Object
root = Tk()

# Root Title
root.title("Soap - RPG")

# Set Geometry(widthXheight)
root.geometry('85x75')

# Create style Object
style = Style()

# Will add style to every available button
# even though we are not passing style
# to every button widget.
style.configure('TButton', font =
               ('calibri', 10, 'bold', 'underline'),
                foreground = 'red')

def start_button():

def quit_button():

myButton = Button(root, text="Start", style = 'TButton', command = start_button)
myButton.grid(row=3, column=2)

myButton2 = Button(root, text="Quit", command = quit_button)
myButton2.grid(row=3, column=1)

text = Label(root, text="         Soap RPG\n\nRAM9-Copyright 2021")
text.grid(row=1, column=2)

root.mainloop()

Thnks!

#

ping me if u can help

lime monolith
# digital rose Hi! I'm working on a tkinter start up screen, and I would like one button to be ...

Try this

import time
from tkinter import *
from tkinter.ttk import *
# Create Root Object
root = Tk()

# Root Title
root.title("Soap - RPG")

# Set Geometry(widthXheight)
root.geometry('85x75')

# Create style Object
style = Style()

# Will add style to every available button
# even though we are not passing style
# to every button widget.
style.configure('Red.TButton', font =
               ('calibri', 10, 'bold', 'underline'),
                foreground = 'red')

style.configure('Green.TButton', font =
               ('calibri', 10, 'bold', 'underline'),
                foreground = 'green')

def start_button():
    pass

def quit_button():
    pass

myButton = Button(root, text="Start", style = 'Green.TButton', command = start_button)
myButton.grid(row=3, column=2)

myButton2 = Button(root, text="Quit", style='Red.TButton', command = quit_button)
myButton2.grid(row=3, column=1)

text = Label(root, text="         Soap RPG\n\nRAM9-Copyright 2021")
text.grid(row=1, column=2)

root.mainloop()
versed vessel
versed vessel
hexed sphinx
#

can someone help teach me how to make a calculation in gui

#

i want to make an app about area calculation

#

specifically triangle

#

``from tkinter import*

root = Tk()
root.geometry("400x400")
root.title("Percobaan")

mylabel = Label(root,text="Luas segitiga")
mylabel.grid(row=0,column=1,padx=125)

def hasil():

luas_segitiga = 1/2 * alas * tinggi

alas = float(alas_box.get())
tinggi = float(tinggi_box.get())

my_label = Label(root,text = luas_segitiga)
my_label.grid(row=4,column=0)

alas_label = Label(root,text = "Alas")
alas_label.grid(row=1,column=0,pady=5)

tinggi_label = Label(root,text = "Tinggi")
tinggi_label.grid(row=2,column=0,pady=5)

alas_box = Entry(root,width=20)
alas_box.grid(row=1,column=1)

tinggi_box = Entry(root,width=20)
tinggi_box.grid(row=2,column=1)

my_button = Button(root,text = "Hitung",command = hasil)
my_button.grid(row=3,column=1,pady=5)

root.mainloop()``

#

What should i do if i want to make a calculation

#

luas = area
alas = base
tinggi = height

#

luas_segitiga = formula for area of the triangle

versed vessel
#

!codeblock

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.

tawdry mulch
versed vessel
#

Yeah, my app has to live with that lol

tawdry mulch
versed vessel
#

Do I have to pay for that?

tawdry mulch
versed vessel
#

Lol, imma do it if I ever get some money from the app

#

Right now I need to order the code

#

I feel like there are a lot of functions everywhere

tawdry mulch
#

Anyway I have not thought about this. I will be making a cube timer soon too

#

First I have to get sub 30 :p

versed vessel
#

Cool

#

Iโ€™m sub 30 :p my pb is 25.15

tawdry mulch
#

Noice, my pb is prolly 30 or something but average would be approx 40. But this was like 6 years before, I don't cube now

#

Fine, wbu

digital rose
tawdry mulch
#

Well I have GAN too, or had. I really forget how to do some :p

versed vessel
versed vessel
tawdry mulch
#

I feel like I couldve got sub 10, but then I lost all interest and went into magic ๐Ÿ˜›

digital rose
#

printing text in the center is pretty easy, you can use .center() with a string and run the code in the terminal.

#
#this string will be shifted a bit to the right hand side of the terminal.
print('hello world!'.center(40))

@icy hare

versed vessel
#

Basically I'm making it to solve some problems i had with other timers

tawdry mulch
#

Find the max character that can be inputted too and then divide it by 2?

digital rose
#

@icy hare if you want further organization of text in the terminal, possibly make a UI out of it:
http://urwid.org/
There are some examples in the right hand side.

versed vessel
#

I couldn't have my times on every device, so I'll add an option to automatically sync your times with G Drive

#

And the feature of creating and joining rooms

tawdry mulch
versed vessel
#

Thanks

digital rose
#

you can treat that text as a multi line string and then use .center(int) on it.

versed vessel
tawdry mulch
#

There are alot of source codes that you can take a look at and find out how 'organized' your code is. Those methods can be accessed outside too

digital rose
tawdry mulch
versed vessel
#

the import tkinter as tk makes the code to look cleaner, I'll add that

tawdry mulch
digital rose
#

gys

tawdry mulch
digital rose
#

hello

#

what is

import turtle
tawdry mulch
# digital rose what is ```py import turtle ```

In this step-by-step tutorial, you'll learn the basics of Python programming with the help of a simple and interactive Python library called turtle. If you're a beginner to Python, then this tutorial will definitely help you on your journey as you take your first steps into the world of programming.

digital rose
#

ok

#

ok now i know

frigid sedge
#

Banging my head with understanding how to create a grid... Starting to get clear.

frigid sedge
#

tbh, it's a lot of code for just making this grid ๐Ÿ™‚

golden terrace
#

I wrote a small GUI in tkinter and mainly used the .place() function. Then I read on Stackoverflow in some comment, that this is not recommended due to strange behaviour on other machines. Is this true? Should I change this?

terse path
#

i mean tkinter in general has strange behavior on other machines

#

its more of a rapid prototyping

#

use qtdesigner if you want something that looks professional and you can be guaranteed itll look the same from one machine to the next

golden terrace
#

Oh, thanks. Never heard of this tool! :)
I made the GUI only with the code, which was a real pain on some points. ^^

terse path
#

you can do that in qt if you prefer as well. qtdesigner is a gui based gui design program.

#

both will end up giving you the code based output

golden terrace
#

Already downloaded it ;D

fading basin
fervent lintel
#

Hello guys, I really want to enhance my digital competences and learn Python. Can you recommend me how to start? I've already watched some tutorials and I found them quite helpful. Is there any other sources or any way how to better understand Python? Thank you.

modern marsh
#

try it yourself

modern marsh
fervent lintel
modern marsh
#

ah this is not the right channel for that

#

!resources this will help you get started in python

proven basinBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

golden terrace
modern marsh
#

ah

#

idk if it has problems in some machines

fervent lintel
modern marsh
#

np!

golden terrace
#

Yeah, I just downloaded it and tested it a bit, but I think I'll watch a tutorial before I start messing with it. ๐Ÿ˜…

modern marsh
#

yes

#

realpython has a good tutorial on Qt

#

the rest is just reading docs

sturdy talon
#

what is the best library with a good grid system?

modern marsh
#

Qt has a nice QGridLayout

sturdy talon
#

Ok I shall have a look at that thanks! I didn't really like Tkinter's grid system

modern marsh
#

np!

sturdy talon
#

Anyone know why when I use pip install pyqt5, I get the following error and any solution:
ERROR: Failed building wheel for PyQt5-sip
Failed to build PyQt5-sip
ERROR: Could not build wheels for PyQt5-sip which use PEP 517 and cannot be installed directly

sturdy talon
#

It seemed really bad and unstructured

tawdry mulch
tawdry mulch
#

Then try again

eternal jetty
#

Where can I find the documentation for python GUI?

modern marsh
eternal jetty
modern marsh
#

ah idk sorry

eternal jetty
#

Does all the libraries included in the topic provide Guis?

modern marsh
#

curses is a TUI

#

all others, yes

eternal jetty
#

So not like Windows Form where you can drag and add buttons without code

#

So where do I install TKinter/what is the command for windows?

modern marsh
#

on windows at least

#

if you ticked the Tcl/Tk option in the installer

digital rose
#

any ideas on how to make this in tkinter?

#

or maybe a simple version?

#

hi, i've asked a question in the cheese channel but no one answered and the channel is now locked so i will ask here. i'm starting to use qt to build ui applications but when i made a script error the app freeze and crash whitout telling me the error, is possible to enable it or at least display something when an error occurs?

digital rose
#

no

#

tkinter

#

pygubu designer is a tkninter expansion and allow to make tkinter apps whit a gui

#

whitout code the entire gui

#

i advice to install it to reduce the pain.

#

oh ok thnks

#

is similar to the qt designar but more "flat" but allow to do all the basic stuff of tkinter

dense slate
#

hello, is anyone know how to make json of manyToMany fields with django pls

fading basin
#

@digital rose Can you provide the code.

digital rose
fading basin
swift rune
#

Question on tkinter and getting multiple selections in #help-popcorn.

fading basin
#

I am encountering a problem, when I press the calculate button. I want to initiate a event or a code when the button is pressed but the program crashes, I do not understand whats happening. Here is the code:https://paste.pythondiscord.com/rololonebi.py

lime monolith
fading basin
#

Thank you really, appreciate it. @lime monolith

digital rose
#

Hi

I have a tkinter question

I want to have a button that root.destroys the window that is currently open

and open a new window. How would I do that? In a def(): function?

Thnks

fair igloo
#

no

lime monolith
lime monolith
# digital rose Hi I have a tkinter question I want to have a button that root.destroys the wi...

If you have a TopLevel window that root is not its parent, you can destroy that and open another without the main loop stopping .

import tkinter as tk


class Frame(tk.Toplevel):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        button = tk.Button(self, text='Destroy', command=self.on_button)
        button.pack()

    def on_button(self):
        self.destroy()
        Frame()


if __name__ == '__main__':
    app = tk.Tk()
    Frame()
    app.lower()
    app.mainloop()```
frozen dagger
#

Hello, i have a question, what is the difference between pyqt5 and pyqt6? If they both are same, which one is better?

modern marsh
#

pyqt6 has new features but the Qt6 API is not fully implemented yet in pyqt6

#

so for now pyqt5 would be the one to go for

#

though you can easily switch later on

paper torrent
#

Hi there, I was wondering how I could make it so that my label in tkinter stays in the middle top of the window even after I change the window size using my mouse? All the labels are using .grid btw

code:

#Imports
from tkinter import *
from tkmacosx import Button

#Root
root = Tk()
root.geometry("700x700")

#Labels
myLabel1= Label(root, text="Hello World!")
myLabel2 = Label(root, text="My Name Is TELEMETRY LINGO!")
myLabel1.grid(row=0, column=0)
myLabel2.grid(row=1, column=0)

#MainLoop For Tkinter
root.mainloop()
lime monolith
# paper torrent Hi there, I was wondering how I could make it so that my label in tkinter stays ...

You could have a frame that sits on the root window that is packed with anchor set to N which will keep it at the top centre,
the labels then have the frame as their parent see the following modified example of your code.

# Imports
import tkinter as tk

# Root
root = tk.Tk()
root.geometry("700x700")

# Frame
frame = tk.Frame(root)
frame.pack(anchor=tk.N)

# Labels
myLabel1 = tk.Label(frame, text="Hello World!")
myLabel2 = tk.Label(frame, text="My Name Is TELEMETRY LINGO!")
myLabel1.grid(row=0, column=0)
myLabel2.grid(row=1, column=0)

# MainLoop For Tkinter
root.mainloop()```
paper torrent
#

๐Ÿ‘

#

IT WORKSSS
Thanks @lime monolith

proud walrus
#

(i asked that in general but no one answered so imma try here)

I have a question tho. is PyQt5 really worth my time?
I'm looking to do some cool stuff, and for that i need frames to be transparent, blur effects on transparent frames and other stuff, ability to have custom window borders, animations, see-through windows (windows that are transparent but whatever is on the window wont be) and a lot more stuff if i want to go mad with it.

worthy ridge
proud walrus
#

yes on everything?

worthy ridge
#

yeah

proud walrus
#

ok. thanks

eager beacon
proud walrus
#

im on linux.

eager beacon
#

pithink well let me know if you figure it out!

proud walrus
#

aight.

lime monolith
#

data is only defined as a local variable inside of the function get_column_data ( which you have defined twice btw)
In your btn_clicked event handler function did you mean to call the function get_column_data as it returns data

fading basin
#

@lime monolith yes I want to do that

fading basin
#

I am encountering a problem, when I press the calculate button. I want to print the list in the terminal, but when I press the button it shows me an empty list, If I entered the data it to the table and then press the button it show me data not defined,I want to call the function get_column_data as it returns data. I do not understand whats happening. Here is the code:https://paste.pythondiscord.com/jocozeculi.py

proud walrus
#

any way to get desktop notifications with python?

proud walrus
#

im on linux and i need it to be installed with just a normal pip3 install command

short heath
#

Hi, im currently trying to build a ui with tkinter that can do audio analysing. I have the code where my sound wave and spectrum graph will move if there is a sound. Next, I created a button to run the code for the sound wave and spectrum graph. The problem is that the moment i run my code, the sound wave and spectrum graph runs automatic and the buttons i created disappeared. Can somebody help me with this problem? Please and thank you.

copper lintel
#

can anyone help me with kivymd

granite mason
#

Guys has anyone ever experienced error while installing pyaudio? If so what can be done to correct it?

granite mason
hazy umbra
#

What is not clear from this error? ๐Ÿ™‚

granite mason
#

I have already dowmloaded the build tools

#

But it still shows the same error

hazy umbra
#

well I have 0 experience with this particular toolset but knowing windows, was the installation completely smoothly? did you restart after installing it?

hazy umbra
#

seems there are certain compatibility issues across versions

narrow nebula
#

i have a function that generates an list out put that i put into a label. currently my label is inside the function and gets called every time overlaying my current label without overwriting it. is there an elegant solution ?

worthy ridge
#

@granite mason u need to use a wheel

#

pyaudio in pypi compiles and builds locally so it need portaudio

narrow nebula
#

sorry yes i am atm using tkinter

digital rose
#

I see. Could you show what code you have up until now?

narrow nebula
#

sure but be warned. i basically started 3 days ago. ill just pm

digital rose
#

You can use the paste service.

#

!paste

proven basinBOT
#

Pasting large amounts of code

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

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

digital rose
frozen dagger
#

How do i increase size of label in pyqt5?

ivory ember
frozen dagger
#

yes

#

im new, im sorry if its a nooby question

#

๐Ÿ˜

ivory ember
#

its fine

#

you need to create a QFont obj

#

like so

frozen dagger
#
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow

import sys

import time


def window():
    app = QApplication(sys.argv)
    win = QMainWindow()
    win.setGeometry(100, 100, 500, 500)
    win.setWindowTitle("Radrider")

    label = QtWidgets.QLabel(win)
    label.setText("Hello")
    label.move(0, 0)

    label2 = QtWidgets.QLabel(win) # Working
    

    win.show()
    sys.exit(app.exec_())


window()
#

this is the code so far

ivory ember
#
label = qtw.QLabel()
label_font = qtg.QFont("Arial", 12, qtg.QFont.Normal, False)
label.setFont(label_font)
frozen dagger
#

So i need to make "Label"'s size bigger

ivory ember
#

args are as such: <font family/name>, <pointsize>, <style>, <is italic>

frozen dagger
#

hm

#

got it

#

whats qtg?

#

QtWidgets?

ivory ember
#

mb

#

QtGui

frozen dagger
#

alright

ivory ember
#

from PyQt5 import QtGui as qtg how it was imported if you care

frozen dagger
#

alright got it thank you

#

๐Ÿ‘

ivory ember
#

np, feel free to dm me if u need more help

worthy ridge
#

@frozen dagger dude use designer

cedar sail
#

Hey just trying to get my pandas updated from the command prompt and I'm having issues. I keep getting an incompatibility error when I try to install/update stuff. Is this the right place to diagnose my error?

young sedge
frozen dagger
pseudo folio
#

How can I make a snappable grid layout in PyQt? (For example, like the grids that 2D CAD programs)

stable folio
#

Hi, I am trying to build a video editor with pyqt5. I need to connect the video slider, with the timeline. The ones marked with a red arrow. Does anyone have an idea how to do it?

versed vessel
#

What is the optimal resolution for the icon of my app in the window and in the taskbar?

upbeat dove
#

Good night

#

i wanna visualize a SQLite database in a PySimpleGUI window

#

anyone know if i can do this with a table element?

#

or i have to use other element?

ivory ember
#

would something like that work?

stable folio
eager beacon
#

Do both of the sliders have the same minimum and maximum value, or does the timeline slider have the ability to start at an imaginary negative frame?

If you are allowing a negative offset and the sliders have different widths, you will need to create some sort of positionToValue and ValueToPosition methods that translate the the timeline slider position to the video player slider position and vice versa.

polar wave
#

hi! How do I make the font i picked on a font chooser as the default font of the program?

Here's the font picker I'm talking about:

self.master.tk.call('tk', 'fontchooser', 'configure', '-font',
                'helvetica 24', '-command', 'command to make default font here')
self.master.tk.call('tk', 'fontchooser', 'show')```
tired echo
fluid tinsel
#

How can I visualize an AST in a PySimpleGUI interface?
I have the AST, but not visually. How would I display it?
It's a tree graph.

#

I canโ€™t save it into an image file btw.

#

I'm thinking of treelib, but I want to see if there are any other, better options to display a tree graph in a PySimpleGUI program.

digital rose
polar wave
digital rose
#

ah i see. i didnt read the fontchooser part in your question, my bad.

polar wave
#

it's fine ๐Ÿ™‚

digital rose
#

@polar wave are you using tkfontchooser?

polar wave
#

yes

digital rose
polar wave
#

also, weight italic doesn't work in config, what is it's replacement???

polar wave
#

that's why it needed to be called using call()

digital rose
#

i would recommend using tkfontchooser, its well documented and easier to work with.

#

it has a built in dialog called askfont().

polar wave
#

this is tkfontchooser's

digital rose
#

yes, so whats wrong with using it?

#

both of them look almost entirely same, so.

polar wave
#

it's just my preference, sorry.

digital rose
#

@polar wave i managed to get this working. now from {Arial Narrow} 24 bold italic you get this:
Arial Narrow, 24, bold, italic separately:

from tkinter import *
from tkinter import ttk

root = Tk()

def font_changed(font):
    size = int(''.join(i for i in font if i.isdigit())) # get size by iterating over the string.

    family_idx = font.index(str(size))

    font = font.replace(str(size), '') # remove the size from font string.

    # remove curly braces.
    font = ''.join(i for i in font if i not in ('{', '}'))

    font_family = font[:family_idx-1]

    font = font.replace(font_family, '')

    attributes = font.split()

    print(attributes, size, font_family)

root.tk.call('tk', 'fontchooser', 'configure', '-font', 'helvetica 24', '-command', root.register(font_changed))
root.tk.call('tk', 'fontchooser', 'show')

root.mainloop()
#

the font_changed function is where i did most of the work. i just kept on iterating over the font string returned by the dialog, and it basically filters out the font family, the font's attributes, and its size separately, namely in these three variables:
attributes, size, font_family.

polar wave
#

ok, thank you! how do you put italic to weight tho?

#

@digital rose this returns

Traceback (most recent call last):
  File "c:/Users/it-admin/Documents/Python/tkinttest/main.py", line 6, in <module>
    italic = Font(family='Ubuntu Mono', weight='italic')
  File "C:\Users\it-admin\AppData\Local\Programs\Python\Python38\lib\tkinter\font.py", line 93, in __init__
    tk.call("font", "create", self.name, *font)
_tkinter.TclError: bad -weight value "italic": must be normal, or bold
PS C:\Users\it-admin\Documents\Python>```
digital rose
#

oh, my bad again. do this instead:

font_ = font.Font(family = 'Fira Code', slant = 'italic')

weight has only two options :bold, or normal.

#

@polar wave

polar wave
#

oh, ok!

digital rose
polar wave
#

ok!

#

what about overstrike and underline, how would i add this to the font class?

digital rose
polar wave
#

oh ok!

digital rose
#

if you dont wont overstruck text, or non - underlined text, set them to 0.

polar wave
#

so just True or False?

digital rose
polar wave
#

it worked! thanks so much!

digital rose
worthy ridge
#

@frozen dagger Qt designer @versed vessel

#

@stable folio slider move event

sleek grotto
#

hey user-interfaces people i have workaround for wakeup application

#

have you got some another idea how to do that?

#
import tkinter as tk
import threading
from pynput.keyboard import Listener as KeyListener
import time


class Example:

    def __init__(self):
        self.Flag_1 = False
        self.thread_1 = threading.Thread(target=self.listener)
        self.thread_2 = threading.Thread(target=self.tk_wakeup)

    def sillyworkaround(self):

        if not self.Flag_1:
            self.root.destroy()
        else:
            self.root.after(200, self.sillyworkaround)

    def GUI(self):

        self.root = tk.Tk()
        s_h = self.root.winfo_screenheight(); h = 70; y = s_h // 2 - h // 2
        s_w = self.root.winfo_screenwidth(); w = 200; x = s_w // 2 - w // 2
        self.root.geometry('%dx%d+%d+%d' % (w, h, x, y))
        tk.Label(self.root, text='Hello World!!!').pack(ipadx=50, ipady=30, fill='both')
        self.root.wm_attributes("-topmost", 1)
        self.root.overrideredirect(True)
        self.root.after(200, self.sillyworkaround)
        self.root.mainloop()

    def tk_wakeup(self):

        while True:
            time.sleep(0.2)
            if self.Flag_1:
                self.GUI()

    def set_Flag(self, *args):

        if str(args[0]) == '<96>':  #  NumPad 0
            if not self.Flag_1:
                self.Flag_1 = True
            else:
                self.Flag_1 = False

    def listener(self):
        with KeyListener(on_press=self.set_Flag) as li_stener:
            li_stener.join()

    def start(self):

        self.thread_1.start()
        self.thread_2.start()


if __name__ == '__main__':

    app = Example()
    app.start()
worthy ridge
#

y u keep calling ur application again and again

#

in the while loop if u can explain the code i can help

sleek grotto
#

those loops take to much from CPU and fan is start to work louder

#

so i'm looking for another idea how to start gui from binded button

worthy ridge
#

@sleek grotto idk about tkinter

sleek grotto
#

does this question fall into the category: difficult questions :D?

worthy ridge
#

no i work in Qt and in Qt u can launch multiple main windows and dont need an seperate thread creation for it

sleek grotto
#

yeah but in this app is only one window

#

i don't need multiple windowed mode

#

anyway in tkinter we can do the same thinks i think ๐Ÿคจ

#

or not

worthy ridge
#

no exp with tkinter so i cant say

narrow nebula
#

i have this wierd issues. Py complains that the Label Pictresult does not have an attribute show. but if i remove it .show() my GUI doesnt display the image even though i have been told i dont need to use .show

digital rose
#

!paste

proven basinBOT
#

Pasting large amounts of code

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

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

narrow nebula
digital rose
#

remove t.show(). t is just an array, it does not have a show attribute either.

lime monolith
narrow nebula
#

ok that fixed it, but what happened?

lime monolith
narrow nebula
#

and when i had my faulty .show command it kept the function from garbage collecting my variable ?

lime monolith
narrow nebula
#

alright thanks learned something new โค๏ธ

brazen estuary
#

whoops, think I posted my question in the wrong channel so I'll ask here instead

#

Best GUI framework for someone coming from a webdev background?
or are they all equally very different from frontend webdev

#

more details: currently using py rich and have a beautiful CLI, but I admit defeat from the limits of running a semi-complex program from a CLI so I will most likely need to find a framework suited for GUIs

digital rose
#

@brazen estuary python is not the best programming language for building a production - suited GUI. it cannot compete with what other frameworks in other languages, (most notably JavaScript or C#) can do. Still, the most prominent are PyQT5 and Tkinter. You can try either of them. (Even though tkinter has a reputation for looking old - fashioned, there are many ways to make it look better).

brazen estuary
#

hmm, thanks. that's what I suspected. wanted to double check before diving in. which brings up a great idea for a new framework... web-based GUI for python... powered by a localhosted api?

#

would that even be possible?

#

so many great CSS + JS frameworks... obviously not all functions would work

young sedge
#

or may be it is possible, I don't know. The problem is...

#

Front end frameworks require client side operations

brazen estuary
#

but functions like showing data would definitely be possible

young sedge
#

to which only Javascript is ok (or Typescript)
I know nothing capable to do the same in Python

brazen estuary
#

hm

lime monolith
#

There is also WxPython to try

young sedge
#

oh wait a second

#

are you wishing Desktop Application?

#

or Web site?

#

I answered from position of web dev

brazen estuary
#

something like tailwinds < local api < python for a locally hosted software would be awesome

#

desktop

young sedge
#

I think it should not be a problem then

#

quite possible

#

never heard of tailwinds though

brazen estuary
#

right, probably not the most efficient, but i dont see why it wouldnt work and im surprsied theres no major projects yet

digital rose
brazen estuary
#

its like... the new trending bootstrap

#

just a CSS framework

#

compiled w/ nodejs

brazen estuary
#

will eventually incorporate licensing and code obfuscation

#

tailwinds could cut GUI development time insanely if there was some unified API for devs

digital rose
brazen estuary
#

performance, not too demanding. security and privacy, important. the users will not be sending data to the internet

#

receiving data, maybe for updates

#

but the api (if made) would be totally local

#

the API would be generated with data fed from another program that they are already using

#

its to optimize that program

digital rose
#

you could still experiment with either of these - Tkinter, PyQt, or WxWidgets, though there will a be a limit to performance, and that limit could be very small.

brazen estuary
#

that's probably what i'll end up doing, thanks for the input guys!

#

but im always going to keep in the back of my mind that a web-based gui framework for python is an interesting concept and something maybe worth pursuing

#

its time to make python sexy

#

;p

brazen estuary
digital rose
#

i dont know what type of web based GUI you will be trying to make, though pywebview is a library that allows you to display HTML in a native gui window, it might be helpful!

brazen estuary
#

something that could be used by frameworks like Electron I guess

#

backend completely python, frontend web-based

#

or web technologies based*

lime monolith
#

There is also PySimpleGui and others that wrap the GUI frameworks and also wraps remi that you could try

brazen estuary
#

cool, I'll take a look at that as well.

#

I just remember using Tkinter 10 years ago in college and shuddering at the GUI

digital rose
#

you're not alone :p

brazen estuary
#

then here and there I see some really nicely done apps/software made solely with python and i always wonder if some new frameworks out there that I dont know about hahah

digital rose
#

even though there's a lot of ways to make tkinter look better, namely themed widgets.

brazen estuary
#

right, I think I saw some repos with premade themes to use

#

that should probably help

#

but from what I remember even those were pretty ugly ๐Ÿคฃ

#

it's probably a bit too "over" to spin up a web server just to use a web-based python gui huh

digital rose
brazen estuary
#

oOoOoo that is clean

digital rose
#

even though it seems like regular Microsoft - styled UI.

brazen estuary
#

well it doesnt look like its from 1995

#

like the default

#

...

digital rose
#

yes, it's a new tkinter theme.

#

its great that you can write entire files with Tcl, and tell tkinter to use them for UI.

brazen estuary
#

damn I'm gonna miss my ascii art in my cli as the header

#

its sexy in a cool, techy way

#

hahahah if you know what I mean

#

I dunno why I like CLIs so much

#

guess it makes me feel cooler ๐Ÿคทโ€โ™‚๏ธ

#

probably a hassle for clients though

digital rose
#

yes, no one really prefers CLI for an app you're supposed to be using on a regular basis, hard to imagine running discord from a terminal ๐Ÿ˜†

#

even though, it's a lot of fun to make them.

brazen estuary
#

it'd mostly be running in the background, but yeah hahah time to ditch that dream

#

anyways, back to work. thanks guys ๐Ÿ‘

#

appreciate it!

#

back already ๐Ÿ‘‹ ๐Ÿคฃ just took a quick look at .tcl -- maybe the framework im looking for is not a framework for web-based GUIs for python, but rather a framework for converting HTML/CSS into .tcl /other existing gui frameworks themes

#

makes way more sense

#

way less headache as well

#

I was surprised to see so many custom images being used for the templating

#

it's very easy to write a script that takes each CSS element on a page, have the script take a screenshot of that element/div/section/whatever and recompile it into a big image

#

reminds me of pre-bootstrap, pre-css days when we used tables with dreamweaver

#

now this really has me thinking...

#

anyone want to criticize the idea before I actually consider starting this project?

#

I love to be shot down, cause then I dont waste time..

#

so please feel free to call me an idiot if there's something on your mind hahaha

#

maybe this would be better suited as question for the subreddit huh

north stump
brazen estuary
#

that looks great, I'm definitely going to take a look. I knew there had to be something out there!

#

this is why I love the reddit community~

#

hm, looks like its heavily flask inspired, which is something I'm sort of familiar with

#

support for pyinstaller, great. Alright, looks like I'll be doing some research on Eel and PyWebIO tonight.

#

later guys~

modern marsh
#

Good luck

stable folio
distant swift
#

Is there a option in Tkinter to add Webview as in PyQt5

#

I'm getting 'TypeError' while add window icon in PyQt5. What is TypeError ? How can I solve it ?

#

ping me on reply

distant swift
# distant swift I'm getting 'TypeError' while add window icon in PyQt5. What is TypeError ? How ...

import sys
from PyQt5.QtWidgets import QWidget, QDesktopWidget, QApplication
from PySide2.QtGui import QIcon

class Window(QWidget):
def init(self):
super().init()
self.setIcon()
self.top_left()
self.initUI()

def initUI(self):
    self.setWindowTitle('Main Window')
    self.setFixedWidth(1920)
    self.setFixedHeight(990)
    self.show()

def setIcon(self):
    appIcon = QIcon('C:/Users/hp/Documents/py properties/i.ico')
    self.setWindowIcon(appIcon)

def top_left(self):
    qr = self.frameGeometry()
    cp = QDesktopWidget().availableGeometry().topLeft()
    qr.moveCenter(cp)
    self.move(qr.moveTopLeft())

if name == 'main':
app = QApplication(sys.argv)
window = Window()
sys.exit(app.exec_())

versed vessel
#

!codeblock

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.

distant swift
#

'''py
print('hello world')
'''

#

nothing ??

ivory ember
# distant swift nothing ??

what does it say at the bottom of the bot's response: These are backticks, not quotes. Use backticks, click the link if you cannot find the key.

worthy ridge
#

@distant swift ur path is wrong

#

U need //

reef bluff
versed vessel
#

Why does my UI looks blurry

#

Like I don't think it is rendering it at 1920x1080

abstract pecan
#

!codeblock

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.

reef bluff
#

how to create your own theme to tkinter? I mean ttk like Azure. I think its html and/or css but idk how to do it.

#

ok, its tcl. Is there any complete tutorial for it?

stable folio
#

Hi, I need to add small pictures to a widget, and then be able to double click on them. What do you recommend? I am using Pyqt5

proven basinBOT
#

Hey @coarse mirage!

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

coarse mirage
#

I'm using PyQt5 and trying to have a gif in my label to change to a different gif on a button click.

#

But for some reason it doesn't work.

#

Here's the code I have so far:

#
              "confident": "C:/Users/nomar/Dropbox/Blueprints/Trucy_Confident_Speak1.gif"}

class Main_Window (QWidget):
    def __init__(self):
        super().__init__()
        self.title = "Dice Game"
        self.left = 10
        self.top = 30
        self.width = 420
        self.height = 540
        self.label = QLabel(self)
        self.button_1()
        self.mw_attributes()
        self.screen()
        self.textbox()
        self.show()
        
    def mw_attributes(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left,self.top,self.width,self.height)
        self.pixmap = QPixmap("C:/Users/nomar/Dropbox/Blueprints/ivc.png")
        self.label.setPixmap(self.pixmap)
        self.label.resize(self.pixmap.width(),self.pixmap.height())```
#
    def button_1(self):
        pybutton = QPushButton(self)
        pybutton.clicked.connect(self.button_click)
        pybutton.resize(111,53)
        pybutton.move(160, 480)
        pybutton.setStyleSheet("QPushButton"
                               "{"
                               "background:transparent;""background-image : url(C:/Users/nomar/Dropbox/Blueprints/ivcbutton.png);"
                               "}"
                               "QPushButton:hover"
                               "{"
                               "background:transparent;""background-image : url(C:/Users/nomar/Dropbox/Blueprints/ivcbuttonhover.png);"
                               "}"
                               "QPushButton:pressed"
                               "{"
                               "background:transparent;""background-image : url(C:/Users/nomar/Dropbox/Blueprints/ivcbuttonpressed1.png);"
                               "}")  
    
    def button_click(self):
        score = randint(1,6) + randint(1,6)
        self.gif_background.movie = QMovie(animations["confident"])
        self.text.setText(f"The roll is {score}.")
        
    def screen(self):
        self.gif_background = QLabel(self)    
        self.gif_background.setGeometry(40, 60, 107, 100)
        self.gif_background.setStyleSheet("background-image : url(C:/Users/nomar/Dropbox/Blueprints/Background.jpg);")
        self.gif_background.movie = QMovie(animations["normal"])
        self.gif_background.setMovie(self.gif_background.movie)
        self.gif_background.movie.start()
        ```
#

Well a snippet of the code at least.

worthy ridge
#

@stable folio style sheet

coarse mirage
#

I thought: def button_click(self): score = randint(1,6) + randint(1,6) self.gif_background.movie = QMovie(animations["confident"]) self.text.setText(f"The roll is {score}.")

specifically self.gif_background.movie = QMovie(animations["confident"]) would change it but I guess not.

digital rose
#

I believe you have to create widget defaults in a Tcl file that you are calling in the tkinter file, and also create images for different widget states, though I'm not sure how to integrate them into the theme.

distant swift
distant swift
#

again TypeError

#

any other ways

worthy ridge
#

@distant swift complete error log please

distant swift
#

wait a min

#

"C:\Users\hp\PycharmProjects\JARVIS Mrk IV\venv\Scripts\python.exe" "C:/Users/hp/PycharmProjects/JARVIS Mrk IV/trash2.py"
Traceback (most recent call last):
File "C:\Users\hp\PycharmProjects\JARVIS Mrk IV\trash2.py", line 31, in <module>
window = Window()
File "C:\Users\hp\PycharmProjects\JARVIS Mrk IV\trash2.py", line 8, in init
self.setIcon()
File "C:\Users\hp\PycharmProjects\JARVIS Mrk IV\trash2.py", line 20, in setIcon
self.setWindowIcon(appIcon)
TypeError: setWindowIcon(self, QIcon): argument 1 has unexpected type 'PySide2.QtGui.QIcon'

Process finished with exit code 1

worthy ridge
#

@distant swift try converting it to pixmap then to icon idk i dont about this way i mostly use QSS to style

distant swift
#

let's see what happens

#

I got error again

#

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

#

what does this mean ?

#

how to solve it

worthy ridge
#

@distant swift ur path l

distant swift
raven lance
digital rose
#

Why aint pyqt5 working well

worthy ridge
#

@digital rose u need some osme background colour or something

raven lance
distant swift
raven lance
digital rose
#

I just added background-image at the beginning

#

Now it gave me this

#

How do I change the size of this image?

#

(Its in a pushbutton)

#

This is for labels

#

Push button

#

How to link scaling ;-;

#

Oops nevermind just set image as "Border image" instead of "background image"

distant swift
#

My PyQt5 window is appearing after every function is executed
I want my window appear first
then functions
especially
pyttsx3 is
coming first

worthy ridge
#

@digital rose ```py
QPushButton#LBT_PSB_mainsearch{
background-color: #262626;
border-radius: 2px;
background-image: url(':/icon_pack/png/16/volume--up_icon-02.png');
background-position: center;
background-repeat: no-repeat;

        color: #78a9ff;
        border: 1px solid Transparent;
        border-radius: 2px;
    }

    QPushButton:disabled#LBT_PSB_mainsearch{
        background-color: #525252;
        color: #6f6f6f;
        border: 1px solid Transparent;
        padding: 8px;
    }

    QPushButton:hover#LBT_PSB_mainsearch{
        background-color: #525252;
        color: #a6c8ff;
        border: 1px solid Transparent;
        padding: 8px;
    }

    QPushButton:checked#LBT_PSB_mainsearch,
    QPushButton:pressed#LBT_PSB_mainsearch {
        background-color: #525252;
        color: #a6c8ff;
        border: 1px solid #262626;
        padding: 8px;
    }
#

@distant swift keep ur show methon under the init

digital rose
worthy ridge
#

@digital rose learning curve is hard

worthy ridge
#

yup

digital rose
#

thats actually good

#

Also are you able to resize the window?

#

how did you do that?

#

(I want to apply it in tkinter)

worthy ridge
#

yeah i havent yet switched to frame less but ave code for that i just dont like the custm scaling ad dragging i have and WM of windows works for me

worthy ridge
digital rose
#

Oh

edgy kestrel
#

Probably more knowledgeable people here

shrewd cradle
#

@edgy kestrel You could try checking the class name with win32.GetClassName on the hwnd, that might be more consistent, not 100% sure though.

edgy kestrel
#

Oh rite, i tried it when i was playing around how the module works but disregarded it as i didnt see any use for it

#

It should be pretty good for this case though

#

Implemented it and seems to work really well

shrewd cradle
#

you could also look into something along these lines which could give you the executable path of the process https://stackoverflow.com/a/42607775

#

That would probably be better than class name, as i'd reckon quite some processes might share the same class name

unique forge
#

either you set that as a background-image

#

or you link a qss file

wary fable
#

How can I make a button like this one using the Kivy module in Python?

true cave
#

if you're using kivy exclusively, you can also use the kivymd source code

wary fable
#

Oh Okey thank you very much

digital rose
#

why do people use classes on tkinter

worthy ridge
#

@digital rose because UI is designed in layers adn for testing dependency independence is good

digital rose
worthy ridge
#

Always class

digital rose
digital rose
#

How do I use "focus_get" in an if statement (I want an event to happen if the entry box is not selected)

queen mist
#

Ummm

#

any idea what im doing wrong