#user-interfaces

1 messages · Page 56 of 1

delicate latch
#

i need the push_register method to invoke the register screen

#

how can i do that?

eager beacon
#

Use a signal

azure vault
#

how do i develop with kivy on PC for an android app?

uncut pawn
#

@inner nest That not the way I want to do it

#

I trying to have 2 files work together in Tkinter, One FILE has one WINDOW and the other file has another window.

#

I don't want to have two windows at the same time

#

I want to have two files that work together and both contain two different windows

#

If anyone can help pls tell me how to do the code

#

thx

azure vault
#

I got a notif for an @ but the @ is gone now

???

silk basin
#

Anyone here have any recommendations on what package to use when trying to implement a live spellchecker inside of a text box?

mint ivy
#

my listWidget activated signal isnt working at the begining when it is made and I need to select an item in it to activate the signal...

#

How can I solve that so there is no need to select an item to activate the signal?

inner nest
#

@silk basin TextBlob and PyEnchant seems to be good libraries. You can found examples online

vague gale
#

No, not really.
@past locust you can pass multiple arguments to lambda as well

rich wigeon
#

hey, anyone here familiar with the internal of click (the CLI library) ? I'm trying to call a command from already validated/converted Parameter but getting lost in the source ... (also lmk if this is the wrong chan, i'm new here)

vague gale
#

@rich wigeon it is not the wrong channel

#

can you explain what's the issue exactly? are you getting any error?

rich wigeon
#

nope, no error and my think works as is, but it's too hacky for my taste, let me explain

#

my goal is to generate web UIs (and later GUIs) from click command definitions

#

i use the Command / Argument definition to generate HTML forms qnd validating them, and end up with a bunch of already validated/coponverted values for the parameters

#

now i want to feed those values into the command callback

#

but the oonly method i found is to turn the options/values into an array of string and feeding that to the parser

vague gale
#

ok so you already made the command but need to add parameters to it?

rich wigeon
#

so the whole conversion part happens twice

vague gale
#

you could add flags to your command

rich wigeon
#

yeah, the command has all the options defined and works as intended on the command line

vague gale
#

you used click.option right?

rich wigeon
#

yep

#

option and argument

#

the core of the issue here is that instead of getting the options from the command line, I get them from a web form

vague gale
#

oh..

rich wigeon
#
                for k, v in form.data.items():
                    par = parameters.get(k)
                    if isinstance(parameters.get(k), Option):
                        if par.is_flag and v:
                            raw_options.append(par.opts[0])
                        elif not par.is_flag:
                            raw_options.extend((parameters[k].opts[0], v))
                    elif isinstance(par, Argument):
                        if len(v):
                            raw_parameters.append(v)
                args = raw_options + raw_parameters
                debug += f"args={args}"

                old_stdout = sys.stdout
                old_stderr = sys.stderr
                sys.stdout = output_buffer = StringIO()
                sys.stderr = output_buffer
                try:
                    output = command.main(args=args, standalone_mode=False)
                except UsageError as e:
                    error = e.format_message()
                sys.stdout = old_stdout
                sys.stderr = old_stderr
                output = output_buffer.getvalue()
vague gale
#

the user has to input the command on the web page instead of the command line?

rich wigeon
#

yep

#

then the form validates and converts the values using the option types defined in click

#

so in this code example, form.data has those values, and they've already been through the validation/conversion grinder

vague gale
#

and is it working as expected?

rich wigeon
#

yeah

#

it's just inelegant

#

to have to convert the options back into their raw form and have them be parsed again

#

the relevant part of the code above is output = command.main(args=args, standalone_mode=False)

#

where args is a list of raw options/args

#

couldn't find any lower level of hooking into click

digital rose
#

Hi

#

I'm not sure if is it the right place to post this problem

#

I'm developing a python launcher (for .py) just like the default one
but the thing is it runs the scripts with PyPy implementation instead of CPython.
I'm trying to add a shortcut of my program to windows context menu
and i did with windows registry

#

but i want to add it in Open with

#

as you can see in the main context menu
there is a shortcut to my program "Run with PyPy"
But i want to do sth that Windows recognize it as a .py file opener

#

Thanks in advance.

azure vault
#

Is PyPy flagged as capable of handling .py files? Idk the inner workings of windows but I believe it just looks for apps capable of handling the file type in question

#

Theres a window in the settings to set all the defaults for different file types

limber crown
#

Hello, how/what module would i use to get python to insert a query into a search bar like this?

maiden dragon
#

Hi I am having a weird problem and I am not really sure how to go about fixing it. I have two functions I have been trying to try and find a bottleneck my data collection and my live plotting of the data. data collection takes about 2 seconds per cycle and the plotting takes about 0.2 sec per cycle both of these speeds are acceptable. however the issue seems to be when a live plot is open the data collection slows down to between 4-14 seconds per cycle which is way two slow. Ideal time for data collection would be 1 second per cycle. i can post some relevant code but i cant figure out how to go about fixing this

#

the data collection is on its own thread btw

tawny edge
#

@limber crown Tkinter would be the best

lethal vapor
#

@limber crown Yes, if that's a website. You can use Selenium to automate that task.

#

@limber crown If it's a desktop app you can use PyAutoGUI. But from the looks of it looks like a website.

uncut pawn
#

how to link two python files together

#

pls help

#

me

safe moon
#

If they are in the same directory you can just use import

uncut pawn
#

what is a directory

#

I am new in python

#

@safe moon

safe moon
#

It’s where it is saved on your computer

uncut pawn
#

K

#

it did not work

#

@safe moon

#

I try that 5 to 6 times

#

it did not work

#

put it in different folder

#

made a new file

#

nothing

#

worked

safe moon
#

So you have file1 and file2 in the same save folder on your computer

uncut pawn
#

yes

safe moon
#

Then inside of file1 you should be able to do “import file2”

uncut pawn
#

yes

safe moon
#

From there you should be able to use stuff from file2 inside of file one

uncut pawn
#

yes

#

but I we i write it

safe moon
#

Is it giving an error when you try and use a method from the second file?

uncut pawn
#

will how

safe moon
#

Can you send a sample of the code where you are having the issue?

uncut pawn
#

k wait

#

here

safe moon
#

I’m not to sure about tkinter since I mainly use pyqt5 but if I had to make a guess I would think it’s you need a different pass your window differently

uncut pawn
#

how do I do that

safe moon
#

With tk I’m not to sure

uncut pawn
#

k

#

thx

bronze basin
#

@uncut pawn your importing the same file in the same file?

#

thats most likely your error

#

i think what you want is, to write that line import mymodule2 as m2 in your mainmodule.py

#

and then it should work unless there is some other issue

bronze basin
#

you should always import the file you want to import in another file

#

not the same file itself

robust willow
#

help

#

help

#

until i know someone is gonna help me im not gonna say anythign

#

@fickle rivet

#

PLEASE

#

IM NOT GOING TO SLEEP UNTIL I FIX THIS ISSUE

#

@grim onyx

#

im trying to make a box you can type in

#

it dosent work

#

ive been up for hours

#

i just want to go to sleep

nimble stratus
#

u want to create a text box right

robust willow
#

yes

nimble stratus
#

try this

robust willow
#

WOW

nimble stratus
#

might help

robust willow
#

a tutorial THAT HELPS

#

THank you

nimble stratus
#

bruh

#

i might be able to solve the error

#

but its gonna take a lot of time

#

and i dont think id be able to explain in text

#

if it dosent help

#

then ill try to solve it @robust willow

#

Check if it is of any use

robust willow
#

Fuck THANK YOU @nimble stratus I CAN SLEEP

nimble stratus
#

really?

digital rose
#

Does anybody have any experience with creating a GUI for discord bot?

nimble stratus
#

Ask in general

digital rose
nimble stratus
#

Nah ask someone there so they can help u here

#

ppl arent active here

#

@digital rose

lusty cedar
#

@sinful sphinx this is not a server to send unsolicited advertisements.

marsh perch
#

can anyone help me with something in tkinter?

lost tangle
#

When i build a kivy app with buildozer buildozer -v android debug , where does it get the dependencies from ?

inner nest
#

@marsh perch ask your question

marsh perch
#

i have a list with messages which i want to show in a label. after pressing a button it has to show the next message in the label but i cant seem to figure out how

inner nest
wide turtle
#

hey guys :)

lost tangle
inner nest
#

I don't know, I found this in the buildozer github https://github.com/kivy/buildozer > "For Android, buildozer will automatically download and prepare the build dependencies. For more information, see Android-SDK-NDK-Information. Note that only Python 3 is supported."

lost tangle
#

I don't know, I found this in the buildozer github https://github.com/kivy/buildozer > "For Android, buildozer will automatically download and prepare the build dependencies. For more information, see Android-SDK-NDK-Information. Note that only Python 3 is supported."
@inner nest In that case, how would i add a pip package that i downloaded from github (cloned and installed) in the dependencies

#
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'``` I get this error while building apk in buildozer
inner nest
#

it seems buildozer.spec file is your friend ^^
https://buildozer.readthedocs.io/en/latest/specifications.html
"requirements: List, Python modules or extensions that your application requires.

The requirements can be either a name of a recipe in the Python-for-android project, or a pure-Python package. For example, if your application requires Kivy and requests, you need to write:

requirements = kivy,requests
If your application tries to install a Python extension (ie, a Python package that requires compilation), and the extension doesn’t have a recipe associated to Python-for-android, it will not work. We explicitly disable the compilation here. If you want to make it work, contribute to the Python-for-android project by creating a recipe. See Contribute."

#

or maybe its your python path ?

lost tangle
#

Thank you..

silent cedar
#

is there any way I can add a Frame to tkinter.Text

#

since Im using tkinter.ttk.Notebook and I need to insert text

digital rose
#

in tkinter, is it possible to make it so when the user puts some text in an entry the entry doesnt display the text, but instead some ***? kinda like what google does when you put in passwords

inner nest
#

@digital rose widget = Entry(parent, show="*", width=15)

digital rose
#

thanks!

oblique nova
#

say i am using pycharm in debug and my script throws an error. I still have access to the running program to input commands, but it will no longer run automatically without some sophisticated bypass. Is there a way to continue after an exception in pycharm?

inner nest
#

@oblique nova your question is not really related to user-interfaces, I think you might ask your question in #tools-and-devops channel

oblique nova
#

@inner nest Thank you I will do that

#

(I see now, this channel is about building gui with python, not using a gui for python lol)

storm jay
#

in tkinter is there a way to display the ui in fullscreen

inner nest
#

@storm jay root = tk.Tk() root.attributes('-fullscreen',True)

storm jay
#

ok 1 min i'lll try that

#

but when i do that it is going to complete fullscreen wherein the close button is missing and i cant see the taskbar beneath...it has completely gone to fullscreen......it has filled the whole computer screen....

inner nest
#

ow

storm jay
#

is there a solution for that ??

inner nest
#

you can get the resolution directly by the os

storm jay
#

how to do that

inner nest
#

or

#

import tkinter as tk

root = tk.Tk()

screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()

storm jay
#

should i give any value inside the screenwidth and screenheight

inner nest
#

I think winfo_screenwidth() return the width value

storm jay
#

import tkinter as tk

root = tk.Tk()

screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
@inner nest when i do this i am getting a tiny window

inner nest
#

with root.setGeometry(screen_width, screen_height) ?

storm jay
#

ya

#

i am getting a small windows

#

i am getting a small window

inner nest
digital rose
#

Hi

proper grove
#

I want to build a simple GUI for my automation script, being able to choose a few options (including date). Which GUI framework is recommended?

digital rose
#

in python?

proper grove
#

yes

digital rose
#

do you know about tkinter

#

is cool to make GUI applications

proper grove
#

I heard about Tkinter but haven't used it yet, am wondering if I should use that or something else like Qt

digital rose
#

I heard about Tkinter but haven't used it yet, am wondering if I should use that or something else like Qt
@proper grove Yeah It's cool to make applications

#

do you want a simple example?

#
from tkinter import *
root = Tk()
Label(root, text="Hello World :D").pack()
root.mainloop()
#

Run this out

proper grove
#

I will thanks

digital rose
#

you're welcome

proper grove
#

Cool

digital rose
#

👍

proper grove
#

OK I'll play around with Tkinter a bit and see if I can make it work

digital rose
#

Yeah it's cool to make apps

#

good luck

#

👍

static cove
#

So you're not storing anything, because you're saving the output of the .grid() function, which doesn't return a value

#

You want to split up the initialization of a widget and the placement of a widget

#

I'm not entirely certain what you mean by "copy of a task for the button" either.

#

You want to save the task in a button before the task is pressed?

#

So your buttons are created from a for loop and associated with some task function. The problem is that when you press the button it isn't starting the task function but is... printing the string?

#

If you overwrite the string on the button, unless you store the original string elsewhere, you can't get it back.

#

You don't overwrite the original string or you hold the original string in a temp value that you can reference when you want it back.

#

Well I'm not really understanding the use case where you'd have to overwrite the string the button is associated with

#

what exactly are you aiming to store in that odd globals()["task_state_" + str(task_count)] Because right now you're not storing anything.

#

but are you actually trying to store the button you create there? Are you planning on using it later?

There really isn't a solution with your current implementation. Once you overwrite the text associated with the button, unless you're storing the original text elsewhere that you can reference, there isn't a way to get it back

#

So, this is the part of your code that's actually creating and placing the button:
Button(text=task, command=lambda: press_button(task)).grid(row=task_count, column=3)

This part, is currently doing nothing but storing a NoneType value: globals()["task_button_" + str(task_count)]

So I'm not sure what you mean when you say "give it the same name". Multiple buttons can have the same label and still be distinct objects in memory.

#

What's wrong with this topical channel?

#

oh, you mean voice help. I'm currently watching a lecture, so I won't be able to chat right now

#

why can't the button have a label of "task" and not the name of the task itself?

#

the text on the button itself.

#

But you said you're having trouble with the text on the button changing/not changing

#

Oh, you're saying it's using the last task in the for loop, not the one assigned at creation

#

instead of comannd=lambda:dasdfasdf use command=partial(press_button, task)

#

lambdas only resolve references when they're started (i.e. when you press them). Partials will "freeze" the reference when you initialize them

#

at the top of your file from functools import partial

#

Sorry it took a bit for me realize what was happening

#

glad it works now

royal aurora
#

Hey guys, not sure if this is the right place to ask for help, but here it goes: I want to make a small "app" to read data from a database. That I know how to do, but my problem is that I want to show it on a graphic, anyone free to help me?

exotic abyss
#

what u mean with graphic ?

#

You mean a user interface

royal aurora
#

A graphic to show the data (inside the user interface)

distant sand
#

Is it possible to build a UI pyqt5 without downloading the designer

#

Can I just code it like tkinter

#

Cuz I think the pyqt5 requires subscription?

#

Idk

lethal cipher
#

in tkinter how do I make the window be maximized

static cove
#

@distant sand pyqt5 doesn't require a subscription. But you can absolutely build UIs without that program. I personally don't like to use Designer

distant sand
#

@static cove can you please recommend a tutorial

#

Thanks

lethal cipher
#

in tkinter how do I make the window be maximized thinkmon

digital rose
#

Can someone help meeee

lethal cipher
#

where is the grid?

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

lethal cipher
#

so what is the program U R trying to make

#

so I can help U Better

#

yes please

#

uh

#

!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.

lethal cipher
#

Ik

#

let me run the program quick

#

that bug isnt in Your code

#

its tkinter

#

but if you want to see my code

#

so U can see it and learn from it

#

mhhhhh

#

yes

#

or do U want me to paste the code

#

its a little long

#

ok

#

!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.

lethal cipher
#

uh it says its over 2000 characters

#

yes

#

here copy and paste the code from here

#

did U take a look

#

Your welcome does it look nice

#

its my second week in GUI so I'm open to suggestion's

#

whats that?

#

weird

#

?

#

it ran on mine and on my family member computers

#

oh thx

#

ok

#

thx

#

I DMed

#

it has customization features

#

yes

#

thx

#

of course

#

😆 first not family member that ran my code

#

yesterday I made a piano tiles bot

#

if U need help in learning Tkinter im good at it

#

Just DM me

#

im currently working on a MS paint clone

#

as a fun project

#

yeah me too

#

😃

#

so far U can draw and erase the buttons and draw over the button LOL!

#

ok thx

#

cya

#

yeah

#

👋

hollow ether
#

Hello guys,

I just started using PyQT5 and I've been doing some JavaFX before so I have some knowledge about GUI programming. I'm using PyQT5 and QT Designer to make my application. I just wonder (what I can't seem to find an answer on google of) how to work with different scenes?

I have created a MainWindow and been able to use that buttons there to preform some action, but how do I create another scene and put other elements there?

bronze basin
#

QStackedWidget

fallen rain
#

hello

#

I want to make a gui like this

#

There should be an image on the left and a frame on the right
the frame should contain a few text labels

#

the whole window should also be resizable

#

how can I go about this? Please help me I use tkinter thanks

fallen rain
#
class WelcomeScreen(Modal):
    def __init__(self, master, loop: asyncio.get_event_loop, event: asyncio.Event):
        super().__init__(master, loop, event)
        self.WelcomeImage = ImageTk.PhotoImage(Image.open("data/images/stock_welcome_image.jpg"))
        self.WelcomeImageLabel = Label(self.master, image=self.WelcomeImage, width=800, height=800)
        self.AccessFrame = Frame(self.master, pady=20, padx=50, border=50)
        self.signup_modal = SignUpModal(self.AccessFrame, self.loop, self.event)

    def show_modal(self):
        self.WelcomeImageLabel.grid(column=0, row=0)
        self.AccessFrame.grid(column=1, row=0)
        self.signup_modal.show_modal()```
#

this is what Ive comeup with now

#

this is what I have now

#

But it isnt scalable

#

I need the frame on the right also to be scalable

#

how to do this? Please help me
thanks!

inner nest
#

@fallen rain A solution might be to pack() two frames side by side. One with your image and a second with your entries in a grid. Because pack() method resize elements dynamically while grid is more tricky to configure.

fallen rain
#

Okay

#

this is the actual image

#

but in the gui its zoomed

#

I dont want that

#

it affects the clarity

#

How to fix that?

inner nest
#

What type of widget are you using ? @fallen rain

fallen rain
#

frame

#

@inner nest

inner nest
#

did you try in a label or in a canvas ?

fallen rain
#

in a window

#

the main window

#

root

deep hornet
#

hi

#

i am learning tkitner for gui as my first module

#

any suggestions

inner nest
#

you can resize your image with ImageTk object

#

@deep hornet you can start with smalls projects like print meteo for a city given by the user

deep hornet
#

ok thx @inner nest

#

umm.....

amber roost
#

@digital rose grid_forget() all widgets that you know are in row 2; they may be retrievable by other means as well, hold on

digital rose
#

Hi

#

grid_forget() or pack_forget() or place_forget() it's like not show the widget

amber roost
#

Alright, technically you could winfo_children() the parent and then call an empty grid_configure on each of the returned children to test whether they are in row 2, but instead of doing that I recommend keeping track of your widgets at python level

deep hornet
#

yes

digital rose
#

okay plus1

#

what's you're problem?

#

i am learning tkitner for gui as my first module
@deep hornet ah welcome

deep hornet
#

umm what @digital rose

digital rose
#

Do you want example?

deep hornet
#

no

digital rose
#

okay 👍

deep hornet
#

just want to ask if u have anything like suggestions

digital rose
#

ah hmmm

#

suggestion like idea?

#

suggestion of what?

#

hmmm

deep hornet
#

like

#

what to know before

#

where to leanr from

#

@digital rose

digital rose
#

ah

#

Do you know the ttk ?

deep hornet
#

i am starting to learn

digital rose
#

ah sorry

deep hornet
#

what

digital rose
#

I advice you to watch the tkinter serial

#

it's really cool

deep hornet
#

i just want suggestions as to what to leanr before

#

and where to learn it from @digital rose

digital rose
#

ah I understand it now

deep hornet
#

lol

digital rose
#

I can't find any thing to suggestion it

#

so yeah

#

Boom

deep hornet
#

what

#

just leave it

#

u are confused

digital rose
#

I'm learned tkinter direct

#

u are confused
@deep hornet yeah much

deep hornet
#

so just leave it

digital rose
#

I'm learned tkinter direct
and I'm was not learned the basics first 😂

deep hornet
#

!clsoe

#

!close

#

oh sry

digital rose
#

?

#

oh sry
no problem

deep hornet
#

i thought this was a help channel

digital rose
deep hornet
#

oh

digital rose
#

👍

digital rose
#

Umm I had a question but I see is not the right place to that?

#

Good afternoon everyone by the way

#

Ah well I think it is?

#

Lol

#

Ok so I'm gonna make my question, please forgive me if is not the right place. I am building an instagram bot with Tkinter. The thing is that when I have an Entry when I click the botón for that entry I save the value in a list and I show the list in the screen. But when I click that botón the entry and the text label just get wild and we can not see the text anymore. I have to resize the screen and it works

#

Any idea why?

#

I just got it!

#

Thank you

digital rose
#

really cool

#

Guys

#

If you want

#

to fix this buttons

#

or How to convert this Buttons

#

into this Buttons

#

it's easy

#

Who want the method ?

#

I just got it!
@digital rose Cool

celest jewel
#

I have one question how do you make a user interface using python? would you like use tkinter or PyQt? just tag me for if you answer so that i know.

remote ravine
#

@celest jewel yes someone would use PyQt5 or PySide2, Tkinter, Gtk

digital rose
#

Tkinter is better

celest jewel
#

@remote ravine I have never heard of PySide2 and Gtk. Are those like modules in python?

#

@digital rose ok

remote ravine
#

@digital rose if ur gonna say something at least say something right

#

@celest jewel PySide2 and PyQt5 are almost the same.. let me send u a link

digital rose
#

@digital rose if ur gonna say something at least say something right
what??

celest jewel
#

@remote ravine also what do you recommend I use?

remote ravine
#

spork

celest jewel
#

Also i am still a beginner

remote ravine
#

to give u more info

celest jewel
#

ok thank u

remote ravine
#

also i use PyQt5 currently BUT u use whatever is better for you

celest jewel
#

Ok

remote ravine
#

@celest jewel which OS are you using ?

#

Operating System

#

he gone... bruh

celest jewel
#

oh sorry

#

i use ios

#

basically a imac

remote ravine
#

oh... well i basically have no knowledge about that

celest jewel
#

ok

#

it is o

#

k

remote ravine
#

tbh idk if qt ever supports macs

celest jewel
#

ok

remote ravine
#

go with tkinter in this case

celest jewel
#

ok

#

thank you for everything!

finite junco
#

Trying to use this line of code every tkinter tutorial on youtube uses

#

not sure why its doing this

#

Even the docs mention this

finite junco
#

???

plain elk
#

It's not an error, it's just VS Code and its linter complaining

fallen rain
#

guys

#

So I have this

#

and this

#

notice the huge space below the login tab?

#

Its ugly

#

how can I fix it?

#
class WelcomeScreen:
    def __init__(self, master, loop: asyncio.get_event_loop, event: asyncio.Event):
        self.master = master
        self.loop = loop
        self.event = event
        self.WelcomeImage = ImageTk.PhotoImage(Image.open("data/images/stock_welcome_image.jpg"))
        self.WelcomeImageLabel = Label(self.master, image=self.WelcomeImage, width=800, height=800)
        self.AccessFrame = Frame(self.master, pady=20, padx=50, border=50)
        self.TabControl = ttk.Notebook(self.AccessFrame)
        self.LoginTab = ttk.Frame(self.TabControl)
        self.SignUpTab = ttk.Frame(self.TabControl)
        self.TabControl.add(self.LoginTab, text='Log In')
        self.TabControl.add(self.SignUpTab, text='Sign In')
        self.signup_modal = SignUpModal(self.SignUpTab, self.loop, self.event)
        self.login_modal = LoginModal(self.LoginTab, self.loop, self.event)

    def show_modal(self):
        self.WelcomeImageLabel.grid(column=0, row=0)
        self.AccessFrame.grid(column=1, row=0)
        self.signup_modal.show_modal()
        self.login_modal.show_modal()
        self.TabControl.pack(expand=1, fill="both")```
this is how I've defined it
finite junco
#

It's not an error, it's just VS Code and its linter complaining
@plain elk what do i do then

fallen rain
#

how can I fix it?
@fallen rain Like I want both the content of both the tabs to be in the center

#

that will be nice

#

thanks!

median ridge
#

Is it possible to create nice modern looking UIs with tkinter

fallen rain
#

yes

#

its regarding tkinter notebooks

#

thanks!

median ridge
#

hmm okay thank you

plush stream
finite junco
#

@plush stream I just wanted to say I love your wallpaper :D

plush stream
finite junco
#

thanks <3

past locust
#

@plush stream wdym hamburger menu?

plush stream
#

That three horizontal stripes menu

past locust
#

or are u talking about the right click menu?

#

@plush stream

plush stream
#

No, im talking about that three blue stripes in the left upper side of the gui

past locust
#

ah

#

i can suggest a solution in tkinter if u want

lethal cipher
#

hey I need help

#

how do you set a default extension

#

!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.

lethal cipher
#

how do you set a default extension```python
inputName = asksaveasfilename(defaultextension='#.txt')

inner nest
#

filedialog.asksaveasfilename(initialdir="/", initialfile="results", title="Save",defaultextension=".xlsx")

#

or

#

(defaultextension='.json', filetypes=[("json files", '*.json')])

#

@lethal cipher

lethal cipher
#

thx

#

and

#

I mean if you have 3.9 installed and 3.7 how do U write a python script in only 3.7

digital rose
inner nest
lethal cipher
#

!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.

lethal cipher
#

why doesnt it work```python
def saveText(event=None):
global fileName

if not fileName :
    inputName = asksaveasfile(mode='w', title="Save the file", defaultextension=".txt", filetypes = (("Python","*.py"),("Text File","*.txt"),("all files","*.*")))
else:
    inputName = fileName

if inputName:
    fileName = inputName
    content = textField.get(1.0, END)
    with open(fileName, "a") as theFile:
        theFile.write(content)
        root.title('{}'.format(os.path.basename(fileName)))
pale vortex
fluid tinsel
#

is there some way to fix up the resolution on tkitner windows?

manic wind
#

which library would you reccommend for a GUI with card-like functionalities?

teal hearth
#

<PySide2.QtWidgets.QPushButton(0x146f570, name="button_lesson_12") at 0x7f88afeb8400>

#

is there way I can access that name='button_lesson_12' ?

#

I running these buttons through a for loop and when i type button.name() I cannot get that

#

EDIT: SOLVED

#

button.objectName() does the trick

digital rose
#

how do I make an if-statement to check if something is in a file name? Like:
if 'data' in file.name:

teal hearth
#

@digital rose yeah what you have is correct

digital rose
#

are you sure?

teal hearth
#

The loop goes to 12 all the time and doesnt stop at the correct one

#

am I missing a line ?

digital rose
#

@digital rose yeah what you have is correct
@teal hearth I am going to use it with open("file_name.txt", "a"), tho

#

so should I use if 'something' in open("file.txt", "r")?

teal hearth
#

open("file_name.txt", "r")

#

try witht his

digital rose
#

I am going to append to the file, tho

teal hearth
#

r means read , w means write and a means append

#

ahhh then use a

digital rose
#

ik

teal hearth
#

so you want to add to the filename ?

digital rose
#

no

#

i want to add to the content inside it

#

so I am using an if statement for getting which file to append to

#

should I use this?
file_name=open("file.txt", "a") if 'data' in file_name: file_name.write("text")

#

is there an official page for files on the docs?

#

in tkinter, is it possible to add a entry for photos?

teal hearth
#

@digital rose youve already opened the file. so only thing remaining is to write to it. maybe what you need is a list of filenames and then if file name is == what you want , open it and write to it

random shadow
#

Someone knows how to use Pysimplegui... Cuz when I convert .py to exe and close the application it still running in background... I'm trying to put one break, but the break stop the hole code in the wrong moment?

left lava
#

In tkinter can we add an image in a background

daring flint
#

I would like to have the pyautogui left click drag a V shape without it letting go of the "click" halfway through, is there anyway to do so?

import pyautogui
import time

time.sleep(2)
 
pyautogui.moveTo(905, 336)
pyautogui.dragTo(984, 306, duration=0.5, button='left')
pyautogui.dragTo(1046, 336, duration=0.5, button='left')
digital rose
#

in tkinter, when i make a label, and then pack it, i can't select it with my mouse

#

i want to do that beacause i wan to ctrl c, ctrl v

#

how do i make the label "selectable"

#

?

storm jay
#

make a button because that is the only one that is selectable.........i think label's arent selectable.......thats what i think........

deep hornet
#

hi

#

anyone good with tkinter

small ridge
#

@deep hornet get the width and height of the gui, and set the button width to half that minus a bit, etc

#

use .place()

deep hornet
#

umm not able to get u

#

@small ridge

small ridge
#

ok

#

get the width of the entire window

#

and set the buttons position to half that

#

same for height

#

because half of the width would be the middle

deep hornet
small ridge
#

sigh

#

google it

deep hornet
#

ok

digital rose
#

@deep hornet what is your problem?

#

how to move this button to the middle
@deep hornet Easy

#

use the place system

#

example:

#
from tkinter import *
root = Tk()
my_Button = (root,text="Button Click Me")
my_Button.place(x = 10, #You're X-Axis Position
                y = 20) #You're Y-Axis Position
root.mainloop()
deep hornet
#

thx

#

@digital rose

digital rose
#

you're welcome

mortal void
#

hey guy's i have create a GUI for Mb to Gb convert using python

digital rose
#

Cool

#

@mortal void

mortal void
#

thanks and subscribe to my channel

digital rose
#

yeah I will

random kelp
#

it worked on my old pc

#

my new one seems to have this happen to it

#

when i do cd Videos

#

or cd documents

#

it works

modern marsh
#

heyyo

#

any good tutorials for pyQT5?

digital rose
#

any idea why this is happening
@random kelp Easy

#

you mean with python pip ? or?

#

If it's with PIP

#

reinstall python

#

and make sure "Add to Path" it's true

random kelp
#

@digital rose I mean, just changing directories

digital rose
#

@digital rose I mean, just changing directories
@random kelp ah make sure the directory is true

random kelp
#

how do i do dthat?'

#

@digital rose

digital rose
#

how do i do dthat?'
@random kelp I mean the directory of you'r py file

#

ah

#

ah

random kelp
#

@random kelp I mean the directory of you'r py file
@digital rose thing is Im just tyring to get into the desktop

#

and for some reason its not working

digital rose
#

ah I knew now

#

this is stranger problem

#

hmmm

random kelp
#

@digital rose any idea on how to fix it?

digital rose
#

@digital rose any idea on how to fix it?
@random kelp Look I have the same

random kelp
#

thats really weird

#

@digital rose why is this an issue?

digital rose
#

maybe we don't make the d captin

random kelp
#

?

digital rose
#

ah

#

look

#

I fix it

random kelp
#

how did u fix it?

digital rose
#

Type the Desktop not Disktop

random kelp
digital rose
#

ah

#

this is stranger

random kelp
#

yes

#

i dont know hwo to fix

#

so

#

how do i fix it?

digital rose
#

I not sure how to fix it sorry

random kelp
#

oh ohk

#

😦

digital rose
#

yeah sorry

#

maybe In windows 10 is defirent

paper bramble
#

Hi

static cove
#

@random kelp This is a bit late, but you can view the directories you're able to travel to with the command dir

eternal apex
#

import time

import cv2
import smtplib

Load the cascade

sender_email = "dhruvkkothari@gmail.com"
rec_email = "kapilkkothari@gmail.com"
password = open("scratch.txt", "r")
passwords = password.read()
face_cascade = cv2.CascadeClassifier('haarscadesfrontface.xml')

Read the input image

cap = cv2.VideoCapture(0)
FaceDetected = False

To capture video from webcam.

while True:

_, img = cap.read()
# Convert into grayscale
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

Detect faces

faces = face_cascade.detectMultiScale(gray, 1.3, 4)
cv2.imshow('img', img)

Draw rectangle around the faces

for (x, y, w, h) in faces:
    cv2.rectangle(img, (x, y), (x+w, y+h), (255, 52, 50), 10)
    FaceDetected = True

Display the output

if(FaceDetected == True):
    for i in range(1):
        message = "There is a guy outside your door."
        server = smtplib.SMTP('smtp.gmail.com', 587)
        server.starttls()
        server.login(sender_email, passwords)
        print("Login success")
        server.sendmail(sender_email, rec_email, message)
        print("Email has been sent to ", rec_email)
        time.sleep(10)
        if(FaceDetected == True):
            messager = "There is still a guy outside your door."
            server.login(sender_email, passwords)
            print("Login success")
            server.sendmail(sender_email, rec_email, messager)
            print("Email has been sent to ", rec_email)
            break
if(FaceDetected == False):
    print("bye")
k = cv2.waitKey(30) & 0xff
if k==27:
    break

cap.release()

Why isn't my code working?

modern marsh
#

In tkinter can we add an image in a background
@left lava yes

steady coyote
#

How i can use a fluent design in tkinter.

past locust
#

What do u mean a fluent design?? @steady coyote

pale sleet
#

thats an oxymoron i think

steady coyote
#

I mean design system including some effects and ui

#

It looks like this

past locust
#

Its a custom ui. You won't have any default functions for making this kind of ui. You'll have to create different custom functions to be able to create this kind of ui. @steady coyote

left lava
#

@modern marsh can you share the code to do that?

steady coyote
#

@past locust thx

modern marsh
#

there maybe a better method

#

but the way i did it was

#

using pillow library create a variable like image that contains the image

#

then,

label.pack()
#

@left lava

#

maybe frames can do this too

left lava
#

@modern marsh cool I’ll try

modern marsh
#

ye

#

?

past locust
#

Nvm i was tryna give an example to @steady coyote

modern marsh
#

ahh ok

past locust
#

The code is too long

modern marsh
#

how to create that sort of ui?

#

with the transparency etc

#

ig its very hard to do that in tkinter

past locust
#

The second example

#

On the website

modern marsh
#

ahh there is another method similar to that

#

make the relief flat, put a round image in, make the bg same as the bg of the window

#

easy round buttons

candid basalt
#

@steady coyote its like insanely hard to do in tkinter, Use Qt if you want some advanced effects

steady coyote
#

Ok. I see

past locust
#

And the most important of all, u shouldn't be doing UIs in python in the very first place. JavaScript has neater UI options, if u want to make a bigger project tbh. @steady coyote

pale sleet
#

if youre on a mac, you could manipulate the objc libs to write UIs

digital rose
#

how do i make the text in a label selectable?

lyric nebula
#

u mean a flat button with no boundaries?

fluid tinsel
#

i think they mean copiable.

primal edge
#

I've only really ever used GUIZero for making graphical interfaces in python and I've had a look around and like the look of PyQt/PySide2.
I've seen that there are licencing issues with them and was wondering which one is "safer" to use, I'm not bothered by the slight differences in their functionality.

bronze basin
#

Pyside 2 has more flexible licensing

fluid tinsel
#

would PyGObject, wxPython, or PySide2 (considering licenses and gui quality on all OSes) be better for an open-source, free to download BUT publicly available app?

ruby ember
#

if you compress your code into a .exe, no one will know you used guizero ( ͡° ͜ʖ ͡°)

bronze basin
#

@fluid tinsel considering quality Pyside2 easily outranks all the others

#

but it is more difficult to learn

#

and for licenses it would be better if you searched it up according to your specific project and situation

#

thot pyside2 should be fine for the usage you stated

fluid tinsel
#

it’s just an open-source public syntax highlighter for something

#

i used to use PyQt so I can remember some things.

fluid tinsel
#

oh I just saw the requirements are:

>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <3.10

which basically means it only runs on python 2.7 to python 3.0. i’m using python 3.8 rn

so due to that, remove it from the options, PyGObject or wxPython?

tribal path
#

3.5 to 3.9 would be fine there

fluid tinsel
#

installation fails.

bronze basin
#

it shouldn't?

#

something is wrong at your end then

#

cause i am using python 3.8.3 and its working just fine

vale flint
#

Hey guys I'm trying to learn tkinter and I'm trying to display an image but only a part of the image comes up on the screen

#

Can anyone help me resize the image?

jaunty yoke
#

@vale flint change the pixel values in line no: 10 ...

vale flint
#

im not sure y, but the output doesnt change when i change the values

digital rose
#

@vale flint well you use place to resize the height and width rather than using pack

vale flint
#

@vale flint well you use place to resize the height and width rather than using pack
@digital rose oh, can you please type out the syntax of that, I'm kinda confused how to do

digital rose
digital rose
#
from tkinter import *
from PIL import ImageTk, Image

window = Tk()

window.title("My program")



image = ImageTk.PhotoImage(Image.open('images/spidermanfalling.jpg'))
my_img = Label(window,image=image,width=200)
my_img.place(height=200)


window.mainloop()
#

example

digital rose
#

Hi

#

cool @digital rose

eternal apex
#

can someone dm me cuz i need a lotta help for a project.
All help is appreciated

deep hornet
#

hi

#

tkinter

past locust
#

@eternal apex you can post your problem here.

digital rose
#

@deep hornet nice job!!! bask in the glory of success aha

deep hornet
#

thx

#

i am really proud of my first tk prgram

#

@digital rose

#

@eternal apex here

#

contact @digital rose he might be able to help u

eternal apex
#

ok

deep hornet
#

gut

vale flint
deep hornet
#

ok

digital rose
#

Hi

#

this ia my first prgram
@deep hornet Really Cool

#

keep going

deep hornet
#

thx

digital rose
#

You're welcome

#

@vale flint

vale flint
#

lmao thanks for noticing

digital rose
#

😂 You're welcome

sly harbor
#

Could this be the right place to find someone that is looking for a project to move a solution from TKinter to be a FLASK application ?

static cove
#

@sly harbor #web-development might be a better option, but we can certainly try to help

obsidian grotto
#

How can I handle user interaction that triggers long-running requests without causing the UI to freeze up?

static cove
#

By using threads

obsidian grotto
#

Know any good code examples for that in a UI framework context like TKinter or pyQT? Or would that be a better question for #async-and-concurrency ?

static cove
#

@obsidian grotto i have examples of it in both tkinter and pyqt. I need to pull the code from a laptop though. Give me ~20 minutes?

obsidian grotto
#

@static cove yes, thank you! 🙂 🙂

static cove
#

@maiden mauve are you getting a specific error?

obsidian grotto
#

@maiden mauve What's the error when you hover over that red-underlined curses?

maiden mauve
#

I ask you and repeat a question @obsidian grotto @static cove

static cove
#

It's unclear what error you're getting from your code, so we're asking for more information

maiden mauve
#

The error is that there is no error without any reason showing this defect to me@static cove

static cove
#

Does something appear when you hover over it?

maiden mauve
#

@static cove

#

Full image

static cove
#

At the top bar, can you click "View" and then "Output"

#

A bottom panel should appear. I then want you to navigate over to "Problems" in that bottom panel

obsidian grotto
#

@maiden mauve what python version are you on?

maiden mauve
#

3.8.6

static cove
#

So that's a pylint warning. In my experience pylint doesn't do a great job with dealing with library import errors. I would recommend switching the linter to flake8

obsidian grotto
#

Weird that pylint gives it red squiggly instead of yellow though on VSCode.

static cove
#

This is an issue specifically with pylint not being able to analyze C source doe by default and curses is a C extension technically

obsidian grotto
#

@maiden mauve just try running it, does it run?

maiden mauve
#

what should I do now? No, keep learning Python or what?
@static cove

static cove
#

Well, it's not a true error, so just keep on trucking. If it's bothering you, you can add --extension-pkg-whitelist=curses to your pylint config file

maiden mauve
#

I do not understand you, I am new to Python@static cove

obsidian grotto
#

@maiden mauve use Python to run the file from the command line! Keep going!

#

@maiden mauve is this your first python program?

#

@maiden mauve That red squiggly is a lie, a fake error, ignore it. Keep writing the program the way the tutorial shows you.

safe void
#

im using tkinter and i want to know how big (width and height) should my window icon be?

obsidian grotto
#

If you want to go the iconbitmap route with an .ico file, those are 16x16 or 32x32.

#

I'd use Imagemagick to convert to that from your source image:

$ tldr magick
Local data is older than two weeks, use --update to update it.


magick

Create, edit, compose, or convert bitmap images.
ImageMagick version 7+. See `convert` for versions 6 and below.
More information: <https://imagemagick.org/>.

- Convert file type:
    magick image.png image.jpg

- Resize an image, making a new copy:
    magick convert -resize 100x100 image.jpg image.jpg

- Create a GIF using images:
    magick *.jpg images.gif

- Create checkerboard pattern:
    magick -size 640x480 pattern:checkerboard checkerboard.png

- Convert images to individual PDF pages:
    magick *.jpg +adjoin page-%d.pdf
#

But I'm sure @static cove has a more well-informed opinion than I do :3

static cove
#

Alright, sorry for the large code block incoming. Spinkyt, this is a rough overview of how I structure my pyqt threaded code (I highly recommend pyqt, it's implementation includes thread safe classes)

class WorkerSignals(QObject):
    new_data = pyqtSignal()

class Worker(QRunnable):
    def __init__(self, *args, **kwargs):
        super(Worker, self).__init__()
        self.args = args
        self.kwargs = kwargs
        self.signals = WorkerSignals()

    @pyqtSlot()
    def monitorDataThread(self, *args, **kwargs):
        print("Do the thing you want to do in a thread")
        print("I found data")
        self.signals.new_data.emit()


class myMainWindow(QMainWindow):
    def __init__(self, *args, **kwargs):
        super(myMainWindow, self).__init__(parent, *args, **kwargs)
        
        self.threadpool = QThreadPool()

    def monitor_data():
        self.monitor_data_worker = Worker()
        self.monitor_data_worker.new_data.connect(self.other_function)
        self.threadpool.start(self.monitor_data_worker.monitorDataThread)
static cove
#

So, in my use case, I use global variables to help lock/unlock long running threads. I don't care about having to stop threads early, so I use QRunnables. If you want to use QThreads, I have examples somewhere in this channel for how to implement that instead. (I'll go find it and link it).

obsidian grotto
#

This should be plenty to get me going, many thanks! @static cove 😁 🍻

static cove
#

Overall, you have a class that's usually called "Worker". This is where the threaded functions actually occur. You can transmit data and progress back via signals. If you need an example of how to transmit data back through a signal let me know.

obsidian grotto
#

I read a tutorial on signals and slots a couple weeks ago, but I think I should go give myself a refresher.

static cove
#

There are some other considerations with QRunnables. For instance, if you don't start a QRunnable within a certain time frame it gets deleted. I spawn and start mine back-to-back so that's not an issue for me.

obsidian grotto
static cove
#

Signals and slots are great! My favorite feature of pyqt

safe void
#

If you want to go the iconbitmap route with an .ico file, those are 16x16 or 32x32.
@obsidian grotto ty!

obsidian grotto
#

@safe void yw

static cove
#

@safe void definitely recommend the .ico route! It makes it easy to use

safe void
#

yup im doing that

static cove
#

You can also go the threaded route with tkinter but it's such a headache if you don't get it right

#

It's also much more annoying to share data between threads

obsidian grotto
#

@static cove Yeah, that was my initial impression of tkinter. It's just something Python threw in because they like having a fat standard library, but I couldn't find any decently complex apps made with it. QT definitely seems to be the talk of the town in the Python community for cross-platform GUI dev.

#

And good to know about PyQT vs. PySide, that there's actually a technical advantage putting aside the philosophical debate.

static cove
#

I think they're equivalent right now (I think there are a handful of small difference technically). I use pyqt5 out of sheer laziness.

deep hornet
#

yes

rocky dragon
#

I had a couple less problems with pyqt5 but beyond some differences like signals it's mostly the same. Neither seem to be in active development except for Qt version updates

bronze basin
#

Pretty sure Pyside 2 has been adopted officially for python Qt under the Qt company so it should be more actively developed

deep hornet
#

hi

static cove
#

There is no "main.jpg" file inside that folder, so it can't find the file

digital rose
#

Hi

#

I have bad internet so I can't see any thing

#

in the image

#

@deep hornet

#

Are you want to open the relative path

#

?

#
from PIL import ImageTk
load = Image.open("C:\\Users\Shihab\Desktop\ZO Image Editor\File_Icon.png")
render = ImageTk.PhotoImage(load)
#

this is the abs path

#

ok so i want to make a calculator with tkinter. so what im thinking is that the user presses a button that adds a string with the digit/operation to the end of a list, and then i use "".join(list) and then it will be like "1+1" and then i use eval() on that string, and then i use the set() method on the StringVar i created earlier. Is there an easier way to do this?

#

Hi

#

hi

#

you mean make calculator with tkinter

#

then

#

yes

#

yeah and you want easier method

#

hmmm

#

if it is posible

#

are you made entry

#

no

#

with buttons

#

ah

#

make a func

#

cuz like then the user has to know python syntax and knows that to use "to the power of" u have to type **

#

and i want to add factorial and i dont want the user to type math.factorial()

#
from tkinter import *
def plus(numbers):
    bla bla ....

Button(text="1",command = lambda: plus(1)).pack()
#

wut is lambda

#

lambda is make you can access to the var in functions

#

ohhhhhhh

#

and i wondered how do i use the function in the command parameter with parathases cuz i need to enter parameter without activating it

#

yeah

#

the lambda is cool

#

and i want to add factorial and i dont want the user to type math.factorial()
@digital rose so I'm really bad in math module

#

factorial is like:
5 factorial is: 5 * 4 * 3 * 2 * 1

#

which is 120

#

ah

#

also

#

how can i stop tkinter from using that "e" that google uses when the number is too large

#

i want to display whole number

#

no "e"'s allowed

#

ah you mean

#

the intreger num?

#

what is intreger

#

integer?

#

yes

#

ah

#

it's easy

#

the round

#

will be cool

#

ok

#
num_1 = 444
num_2 = 33
print(round(num_1 + num_2))
#

output:

477
#

how can i tell tkinter to go on the next line if the label is too large to fit on the same line

#

hmmm

#

easy the if stament

#

look

#
from tkinter import *
test = Label(text="large text ............................").pack()
if test.width > 200:
    print("the Label is bigger than the sreen")
else:
    print("The label is cool")
#

why 200?

#

any number

#

but this is for example

#

the number is the width of your screen

#

What does the Message widget do?

#

?

#

jesus christ

#

ohhhhh

#

what 😂

#

its like a multi-line label

#

that automaticly goes on the next line

#

yeah

#

exactly what i've been looking for

#

cool

#

any chance you know how to scroll trought one?

#

if its THAT big

#

I was tkinking you mean check if the label is bigger than the screen

#

any chance you know how to scroll trought one?
@digital rose ? scroll the text

#

yes

#

im looking at stackoverflow rn

#

ah

#

sec

#

hmmm

#

I don't sure

eternal apex
#

Guys

#

who knows opencv and SMTP email sender

#

please mssage me if you do know

unique forge
#

Hi, I am updating my app which was made with QT5 Designer and want the QLineEdits to expand to the size of its contents. How can I do this. Thanks, Famous8

digital rose
#

hi

unique forge
#

hi

eternal apex
#

i

#

hi

digital rose
#

sorry I don't know in this @eternal apex
what is you'r problem @unique forge

unique forge
#

I want the QLineEdits to expand to the size of its contents

#

how can I program that

digital rose
#

QLineEdits

unique forge
#

yes

digital rose
#

is this module?

unique forge
#

in QT5

#

QLineEdit widgets

digital rose
#

ah I'm sorry I not good at this module

#

I know in tkinter module

unique forge
#

oh

digital rose
#

sorry

unique forge
#

QT5 is not a module

#

@eager beacon Hi, I am updating my app which was made with QT5 Designer and want the QLineEdits to expand to the size of its contents. How can I do this. Thanks, Famous8

digital rose
#

ah

unique forge
#

?

#

Chris_ helped me create the program when I had just started

digital rose
#

so I'm not good in QT5 Designer

#

i'm really sorry

#

I use tkinter for Designer like:

import tkinter
root = Tk()
Button(root,text="Click Me").place(x=10,y=20,width=10,height=40)
root.mainloop()
unique forge
#

ok cool

#

QT Desinger is a drag and drop interface

digital rose
#

ah

unique forge
#

and after creating the UI with drag and drop you program all the widgets

digital rose
#

yeah

unique forge
#

with Tkinter you program everything

digital rose
#

but I prefer the tkinter system

unique forge
#

which I find a bit tedious

digital rose
#

yeah

bronze basin
#

@unique forge

#

just use layouts

#

for your issue

unique forge
#

what are layouts

digital rose
#

layout is the layout of your window

#

have a widgets and ........

bronze basin
#

@unique forge it basically is a predefined way of how your widgets are arranged dynamically

unique forge
#

ok

#

how can I create one

bronze basin
#

it should work for the situation your in if i understand correctly

unique forge
#

because when I press a button it prints text in a QLineEdit

bronze basin
#

in QT designer you right click on your frames and widgets and click layout vertically

unique forge
#

but sometimes the number is really long

bronze basin
#

or any of the options

#

wait you want to expand the size of the Qlineedit?>

#

only

#

?

#

then I am not sure whether this will be as helpful what you need to do this check if the lineedit's value is greater than a certain value and then if it is increase the widget of the lineedit

#

this should work for what your trying to do ^

unique forge
#

yes

hollow needle
#

if i wanted to make a simple UI for a program im writing (just needs buttons, tables, and ability to show image) what would be the best way?

unique forge
#

hi

#

@hollow needle

#

you can use Tkinter, or PyQT5, which has a software called QT Designer, which is a drag and drop interface, \but you still have to program the buttons later.

hollow needle
#

thanks!

lunar kelp
#

you can use Tkinter, or PyQT5, which has a software called QT Designer, which is a drag and drop interface, \but you still have to program the buttons later.
@unique forge tkinter has one as well, its just not as user friendly

unique forge
#

oh

#

it does

#

what is it called

lunar kelp
#

umm hold on, i dont remember off the top of my head

#

what is it called
@unique forge pygubu-designer

unique forge
#

ok

#

thanks

lunar kelp
#

im trying to figure out something though if you have a minute... cant get a style to work, it just makes the border disappear

#
style.theme_create('chat',
                   settings={
                       'TLabelframe': {
                           'configure': {
                               'background': 'gray15',
                               'foreground': '#FFFFFF',
                               'borderwidth': '4',
                               'bordorcolor': '#1DA498',
                               'relief': 'flat'
                           }
                       },
                       'TLabelframe.Label': {
                           'configure': {
                                'background': 'gray15',
                                'foreground': '#FFFFFF',
                                'borderwidth': '4',
                                'bordorcolor': '#1DA498',
                                'relief': 'flat'
                           }
                       }
                   }
                   )
``` neither works and all of those are styles in the ttk.Style() class
unique forge
#

im only familiar with PYQt

#

sorry

lunar kelp
#

its all good, maybe someone else will step in and answer. even without the border options, the border disapears and i dont understand why

#

tkinter isnt a built in in skinny versions of python, maybe thats the issue?

#

idk...
@digital rose idk either, but chances are that its missing from the python libraries. i dont have a clue about Linux though. its been ages since ive done anything on unix/linux

static cove
#

Time.sleep() is stopping the entire gui, including the event loop that shows the label. Then after 3 seconds it quits. You want to have something shown for x period of time and then close it?

fluid tinsel
#

does it matter if I use PyQt5 or PySide2 for an open-source app?

lunar kelp
#

kinda disappointed, but thanks! You’ve always been helpful.
@digital rose tkinkter has an .after() timer. itll be better then time.sleep

fluid tinsel
#

if you need a time sleep you could thread it.
though tkinter as far as i know isn’t thread safe.

lunar kelp
#

dont need it. root.after("time in ms", function) will wait x ms and then call the function

sinful wharf
#

i made a frame in python, and put a button with an image on top of it. when i put my button into the frame the frame dissapears..

#

By the way, im using tkinter in python 3.8.5

#

Here is my code

from tkinter import *
from PIL import Image

def app():
    window = Tk()
    window.configure(bg="#FFFFFF")
    window.resizable(False, False)
    window.geometry("900x505")
    window.title("Notes")

    top_bar = Frame(window, height=48, width=900)
    top_bar.configure(bg="#FAFAFA")
    top_bar.pack(side=TOP)

    # right click button code here

    click_menu = Menu(window, tearoff=0, bd=0, activeborderwidth=0)
    click_menu.configure(bg='#f1f1f1', bd=0, activebackground='#1CC88A', relief=SUNKEN)
    click_menu.add_command(label="Delete Note")
    click_menu.add_separator()
    click_menu.add_command(label="Rename")

    def right_click(event):
        try:
            click_menu.tk_popup(event.x_root, event.y_root)
        finally:
            click_menu.grab_release

    window.bind('<Button-3>', right_click)

    # top bar buttons code here

    addbutton = PhotoImage(file="add.png")

    create_new_button = Button(text="Button", image=addbutton)
    create_new_button.configure(bd=0, bg="#fafafa", relief=FLAT)
    create_new_button.pack(side=RIGHT)

    # note list veiw code here

    note_list = Listbox(width=900, height=457)
    note_list.configure(borderwidth=0, highlightbackground='#ffffff')
    note_list.configure(highlightthickness=0)
    note_list.pack()

    window.mainloop()

app()
#

someone pls help

lunar kelp
#

@sinful wharf

create_new_button = Button(<master missing>, text="Button", image=addbutton)
#

same with your listbox. they have to be built in root elements. root/frame/labelframe/ect

sinful wharf
#

@lunar kelp but when I do that the frame dissspears....

lunar kelp
#

@lunar kelp but when I do that the frame dissspears....
@sinful wharf where are you placing it?

sinful wharf
#

the frame is

#

side = TOP

#

the button is

#

side = RIGHT

#

And I'm placinf the button inside the frame

#

The frame is inside the window

#

@lunar kelp

lunar kelp
#

@sinful wharf you dont have a side=Right that i see

sinful wharf
#

...I do

lunar kelp
#

oh your packing right... it still has to be in a master element... either in the frame or in window

sinful wharf
#

I told you man, the frame dissspears!

#

dissapear*

lunar kelp
#

what are you using for the parent?

sinful wharf
#

window

#

no wait

#

im using top_bar as the parent for the button

lunar kelp
#

its not in the code you gave earlier. its missing the parent... on top of that, give your button a height and a width... probably just filling the box. since you have an image, i cant actually run the code to fix it. but ive seen crazier things in tkinter

sinful wharf
#
from tkinter import *
from PIL import Image
import time

def app():
    window = Tk()
    window.configure(bg="#FFFFFF")
    window.resizable(False, False)
    window.geometry("900x505")
    window.title("Notes")

    top_bar = Frame(window, height=48, width=900)
    top_bar.configure(bg="#FAFAFA")
    top_bar.pack(side=TOP)

    # right click button code here

    click_menu = Menu(window, tearoff=0, bd=0, activeborderwidth=0)
    click_menu.configure(bg='#f1f1f1', bd=0, activebackground='#1CC88A', relief=SUNKEN)
    click_menu.add_command(label="Delete Note")
    click_menu.add_separator()
    click_menu.add_command(label="Rename")

    def right_click(event):
        try:
            click_menu.tk_popup(event.x_root, event.y_root)
        finally:
            click_menu.grab_release

    window.bind('<Button-3>', right_click)

    # top bar buttons code here

    addbutton = PhotoImage(file="add.png")

    create_new_button = Button(top_bar, text="Button", image=addbutton)
    create_new_button.configure(bd=0, bg="#fafafa", relief=FLAT)
    create_new_button.pack(side=RIGHT)

    # note list veiw code here

    note_list = Listbox(width=900, height=457)
    note_list.configure(borderwidth=0, highlightbackground='#ffffff')
    note_list.configure(highlightthickness=0)
    note_list.pack()

    def add_option(note_name, currtime):
        note_list.add(note_name)

    window.mainloop()

app()
lunar kelp
#

you also need a parent for the listbox. and you height and width is greater then that of top_bar so it will cover the frame anyways. or not be fully displayed

sinful wharf
#

just download this image and put it in the same directory if you really want to help me out thanks
btw rename this to whatever ive written in the code/edit the code or something

#

you also need a parent for the listbox. and you height and width is greater then that of top_bar so it will cover the frame anyways. or not be fully displayed
@lunar kelp oh shitttt almost forgot

#

what if my button is larger than the frame...

#

also why is hiehgt=47 not working on the button

#

height**

lunar kelp
#

probably has to do with pack... i place everything, but you should really use grid over the other 2. i just havent used it yet. how my stuff is setup, i pack the parent element, and place everything else inside of it is how i think of it

#

@sinful wharf

from tkinter import *
from PIL import Image
import time

def app():
    window = Tk()
    window.configure(bg="#FFFFFF")
    window.resizable(False, False)
    window.geometry("900x505")
    window.title("Notes")

    top_bar = Frame(window, height=505, width=900)
    top_bar.configure(bg="#FAFAFA")
    top_bar.pack(side=TOP)

    # right click button code here

    click_menu = Menu(window, tearoff=0, bd=0, activeborderwidth=0)
    click_menu.configure(bg='#f1f1f1', bd=0, activebackground='#1CC88A', relief=SUNKEN)
    click_menu.add_command(label="Delete Note")
    click_menu.add_separator()
    click_menu.add_command(label="Rename")

    def right_click(event):
        try:
            click_menu.tk_popup(event.x_root, event.y_root)
        finally:
            click_menu.grab_release

    window.bind('<Button-3>', right_click)

    # note list veiw code here

    note_list = Listbox(top_bar, width=900, height=457)
    note_list.configure(borderwidth=0, highlightbackground='#ffffff', background="black")
    note_list.configure(highlightthickness=0)
    note_list.place(x=0, y=0)

    # top bar buttons code here

    addbutton = PhotoImage(file="add.png")

    create_new_button = Button(top_bar, text="Button", image=addbutton, width=50, height=50)
    create_new_button.configure(bd=0, bg="#fafafa", relief=FLAT)
    create_new_button.place(x=850, y=0)

    def add_option(note_name, currtime):
        note_list.add(note_name)

    window.mainloop()

app()
``` is that what you wanted? i changed the background of the listbox to see where it was
sinful wharf
#

@lunar kelp but the frames background color (#fafafa) isn't showing... That's what I wanted

lunar kelp
#

its not going to if you have an element that fills it.

sinful wharf
#

goddamnit

#

So how to fix it?

#

Put a canvas in the frame? Lol

lunar kelp
#

why do you want the frames bg to show? just change the Listboxs bg to #fafafa

sinful wharf
#

I don't want the entire window to be that

lunar kelp
#

I don't want the entire window to be that
@sinful wharf what exactly are you looking for? thats what im asking. you want the button in the frame, and the listbox being outside the frame?

sinful wharf
#

Yesss

lunar kelp
#

okay... so move the y on the code i gave you down 50 and itll show the frame color

sinful wharf
#
  1. Button
  2. Frame for the button (top bar)
  3. Listbox

Button being inside the frame for the button, and the listbox being outside of the frame for the button, inside the window

lunar kelp
#
from tkinter import *
from PIL import Image
import time

def app():
    window = Tk()
    window.configure(bg="#FFFFFF")
    window.resizable(False, False)
    window.geometry("900x505")
    window.title("Notes")

    top_bar = Frame(window, height=505, width=900)
    top_bar.configure(bg="#FAFAFA")
    top_bar.pack(side=TOP)

    # right click button code here

    click_menu = Menu(window, tearoff=0, bd=0, activeborderwidth=0)
    click_menu.configure(bg='#f1f1f1', bd=0, activebackground='#1CC88A', relief=SUNKEN)
    click_menu.add_command(label="Delete Note")
    click_menu.add_separator()
    click_menu.add_command(label="Rename")

    def right_click(event):
        try:
            click_menu.tk_popup(event.x_root, event.y_root)
        finally:
            click_menu.grab_release

    window.bind('<Button-3>', right_click)

    # note list veiw code here

    note_list = Listbox(top_bar, width=900, height=457)
    note_list.configure(borderwidth=0, highlightbackground='#ffffff', background="black")
    note_list.configure(highlightthickness=0)
    note_list.place(x=0, y=50)

    # top bar buttons code here

    addbutton = PhotoImage(file="add.png")

    create_new_button = Button(top_bar, text="Button", image=addbutton, width=50, height=50)
    create_new_button.configure(bd=0, bg="#fafafa", relief=FLAT)
    create_new_button.place(x=850, y=0)

    def add_option(note_name, currtime):
        note_list.add(note_name)

    window.mainloop()

app()
#

run that code

sinful wharf
#

Kk

#

btw im going for something like this

#

Can I somehow make the image button 2 pixels smaller

lunar kelp
#

ya, thats what mine looks like, just change or remove background for the Listbox. set the other button image to x=10, y=0 or something similar will place the other button in that corner as well... adjust the x/y values accordingly

#

ya adjust the height/width variables

summer marlin
#

Has anyone used Pywebview or qt's webrendrer for a GUI?

#

Is it like a lighter version of electron for python?

pallid crystal
#

hello I asked a question about user interfaces to #help-falafel, thanks

digital rose
#

what is bin()?

digital rose
#

{PyQt5} Hi, i wanna ask Is it mandatory to Call the setupUi method Of a Converted Ui file (PyUic) before accessing it's attributes?

marsh perch
#
def test():
    root = Tk()
    root.geometry('500x350')
    root.configure(bg='#ffc917')

    tweetText = Label(master=root,
                      text='',
                      font=('Verdana', 16),
                      foreground='#003082',
                      background='#ffc917')
    tweetText.place(x=120, y=150)
    mainloop()

    with open('tweets', 'r+') as infile:
        for bericht in infile:
            tweetText['text'] = bericht
            time.sleep(5)

nothing is displaying in my label text whys that?

marsh perch
#

gg

safe void
#

(I'm using tkinter with multiple files)

File welcomeScreen.py:

import tkinter as tk
import main
def WS():
    window = tk.Frame(master=main.mainWindow, height=500, bg="#00ffa2")
    welcomeText = tk.Label(master=window, text="Welcome!")
    window.pack(fill=tk.BOTH)

File main.py:

#startup
import tkinter as tk
import welcomeScreen
mainWindow = tk.Tk()
mainWindow.title("DeHabit")
mainWindow.iconbitmap(r'media\pixil-frame-0 (3).ico')

#main
welcomeScreen.WS()

#runner
mainWindow.mainloop()
#

When i try to run the main file, it throws exception

#

Exception has occurred: AttributeError
partially initialized module 'welcomeScreen' has no attribute 'WS' (most likely due to a circular import)

static cove
safe void
#

it has been fixed, ty!

past locust
#

@marsh perch sorry im late but try :
for bericht in infile: tweetText.config(text=bericht) time.sleep(5)

#

@marsh perch

marsh perch
#

okay thanks ill try that

past locust
#

Yeah sure

unique forge
#

Hi, I want to update my current app created with PyQT5/ QT Designer One of the things I want to add is a setting where I can enlarge and decrease the font size of the text inside QLineEdits. How can I do this. Thanks, Famous8