#user-interfaces
1 messages ยท Page 58 of 1
do you want example
already made photo :/
no
ok
how do i out photo on window?
put*
example?
you can place it on Label or Frame or Button
ok
what is parameter name?
Photoimage
ok
thx
but there is some steps before that
thx
@digital rose you're welcome
is photoimage a widget?
no
it's to open image
then put it
on any widget
example:
from tkinter import *
from PIL import ImageTk, Image
import os
root = Tk()
img = ImageTk.PhotoImage(Image.open("c:\\Users\Shihab\Desktop\M1z4UJsahf.png"))
panel = Label(root, image = img)
panel.pack(side = "bottom", fill = "both", expand = "yes")
root.mainloop()
output:
sec
is PIL required?
no
output:
example:
from tkinter import * from PIL import ImageTk, Image import os root = Tk() img = ImageTk.PhotoImage(Image.open("c:\\Users\Shihab\Desktop\M1z4UJsahf.png")) panel = Label(root, image = img) panel.pack(side = "bottom", fill = "both", expand = "yes") root.mainloop()
@digital rose Instead of going to a location on your desktop, you can just but the photo in the project file
I'm sure it does. I've used it before
like this
from tkinter import *
from PIL import ImageTk, Image
import os
root = Tk()
img = ImageTk.PhotoImage(Image.open("M1z4UJsahf.png"))
panel = Label(root, image = img)
panel.pack(side = "bottom", fill = "both", expand = "yes")
root.mainloop()
weird
it's weird how it's not working
yeah
maybe I want to tell he to get the relative not the abslute
How
I don't know
I fixed it

I just import the os library
then
I was adding str prop
then
the same name of the prop
I make this
os.path.join(os.path.dirname(__file__), path)
like this
path = 'M1z4UJsahf.png'
path = os.path.join(os.path.dirname(__file__), path)
this
join
or
get the file path in relative
that mean c:\\Users\Shihab\Desktop then join it with file name M1z4UJsahf.png
from the realtive path
get the abslute
then join it with the name
then boom
can you convert hex codes to rgb values?
convert it to rgb values
I mean via code
I mean can I right code in python to convert a hex code to rbg values
ah
maybe yes
I don't really sure
@inland notch
in tkinter how can i set the font in a stringvariable?
easy
from tkinter import *
root = Tk()
font = ("arial", # The font name
20, #size of the font
"bold") # second font
Label(root, text="Hello World :D", font=font).pack()
root.mainloop()
nonono
i mean
i make a stringvariable, i set the text in it
wait
nvm
if rgbval[0] <= 255:
Mainmenucanvas.itemconfig(playbutton, fill=_from_rgb((rgbval[0]+1, rgbval[1], rgbval[2])))```
```def _from_rgb(rgb):
return "#%02x%02x%02x" % rgb
def _from_hex(hex):
h = hex.lstrip('#')
return tuple(int(h[i:i + 2], 16) for i in (0, 2, 4))```
this code isn't working?
nvm
i make a stringvariable, i set the text in it
@digital rose ah
You mean
like this
from tkinter import *
root = Tk()
text_var = "Hellow World :D"
Label(root,text=text_var).pack()
root.mainloop()
yes
ah cool
if rgbval[0] <= 255: Mainmenucanvas.itemconfig(playbutton, fill=_from_rgb((rgbval[0]+1, rgbval[1], rgbval[2])))``` ```def _from_rgb(rgb): return "#%02x%02x%02x" % rgb def _from_hex(hex): h = hex.lstrip('#') return tuple(int(h[i:i + 2], 16) for i in (0, 2, 4))``` this code isn't working?
@inland notch this is stranger
new avatar
so is there now a not-bad way of making cross-platform pygame2 games?
or cross platform in general
I know things have changed since I used kivy a few years ago
I have read that pygame2 is basically modern now
and there are alternatives to kivy now
and that pygame2 works with most things now? Anyone have experience?
If I wanted to just jump in and make an android game with python
and have it not be shit
what should I use?
This is probably a better question for #game-development
I thought people who do UI stuff would know faster
it is still pretty cutting edge stuff
I think Kivy has a way to create android apps but I don't know much about the pros and cons of using it over java/kotlin
It does but it's not native and it's not that good TBH. Massive pain in the ass to use, and I haven't tried it with the new pygame yet
I can't remember or not if beeware had a solution to running python on android or not.
I believe so. I'm just looking for suggestions though. I know quite a few things work now, but working and being practical are different things
I will ask #game-dev too
I posted a question about what I'm pretty sure is an easily confirmable bug in plotly in #help-carrot, can someone take a look?
Is tkinter the best ui to use ??
If you already know tkinter and don't know other frameworks then it is
tkinter is trash but it is fun
it's not trash
Tkinter is kinda easy to use.
Yeah. might be a little slow, but it's really good
if all you need is a basic UI
I like it and the canvas is underrated but it doesn't handle graphics very well
I'm making a game, and tkinter is perfectly fine
tkinter lacks customization functionality
someone here asked how to modify a table widget so that the header row would be a few pixels taller than the data rows
but the header row seems to be connected directly to the row height
there are a lot of little things like that example that make it harder to work with when you want to customize the UI
it also doesn't have the greatest documentation
effbot is GREAT documentation
I would agree that it's the best documentation that is available
Hi
hello
are u have a problem ?
alright then
what are you using?
Tkinter
as far as I know you can either have an alpha on all of your widgets or none but you can't do it on a widget by widget basis
tkinter lacks customization functionality
@eager beacon
This is a good example of what I was saying earlier
yeah
any GUI that I can learn (please don't put tkinter)
Pyside2, PyQt5 or wxpython for example
this is what i made i will upgrade it but this is how it looks now
YES I KNOW I HAVENT ACTIVATED WINDOWS IGNORE IT ๐
i dont know if any of you are familiar with the brand Supreme, but their clothes sellout in seconds so i coded a bot to checkout for me. this is the UI i made in tkinter for it
made it photoshop but the buttons and labels are all overlayed in tkinter
wow thats amazing
Anyone with PyQt5 knowledge got an idea how i can solve this?
The code works when its in venv. The problem is when i try to run it via daemon
Is it running without an X server?
I guess so? I didnt set one up (new to this)
When you say "run it via daemon", what do you mean exactly?
Are you using Threading.daemon or something different
So i can control the app over systemctl
Im using normal threading in form of a function decorator
can you show the code?
you can't start the app in a thread you created
if thats what your doing
I'm not super-familiar with doing it in systemd, but you should make your app start after X has started
if you are, move application out and run it before any other stuff
ok i little bit upgraded what i did
anyone know how to make something like Snipping Tool for windows with tkinter
i press "New", draw a rectangular area by dragging my cursor, and then it uploads the screenshot to my django server
how would I implement flood fill on a tkinter canvas (non array based because it is a paint program)
I'm having fun on a side project application to manage recipes and their various stages of preparation. I am using tkinter
for the interface and the data are in a sqlite file managed with SQLAlchemy.
I'm still quite a beginner on python and OOP but I'd like to apply the object paradigm to my project to train myself.
For the moment the data part works but I have difficulties to link my data with my interface.
For now, I have created different "views" that inherit from the tk.Frame class. I would like to be able to navigate between these differents frames by displaying and hiding them.
I manage to do this when the content is fixed by creating a dictionary with the frames inside that I manage with a function where I forget the current frame and display the new frame.
But I can't do it when the content of the frames has to be dynamically generated according to the user's behaviors.
with the data of the database. I couldn't find similar projects on github or advanced tutorials. I would like to have your suggestions. Thanks !
application.py extract :
App(Tk):
def __init__(self, *args):
Tk.__init__(self, *args)
self.frames = dict()
self.frames["home"] = Homepage(root=self) # self is the parent widget of homepage
self.frames["showrecipes"] = ShowRecipes(self)
self.current_frame = self.frames["home"]
self.current_frame.pack
def frame_handler(self, new_frame):
self.current_frame.pack_forget()
self.current_frame = self.frames[new]
self.current_frame.pack()
hi
when I run tkinter in VScode it gives me 100 errors and it says import error wildcat
does anybody know how to fix it?
disable the linter
disable the linter
@plain elk thank you! It worked!
what is the easiest way to create a GUI with 'draggable' elements snapped to irregular grid?
what is the easiest way to create a GUI with 'draggable' elements snapped to irregular grid?
@quasi sinew
PyQT/QTDesigner? Unless you mean, drag widgets around while running. Then I've got no idea ๐
yes, while running
i found out about tkinter, reading up rn,
i think its the highest level i can get for this task
found nothing more specific
Hmm I have no idea
I'm very far from an expert though
Irregular grid makes it a hard one
how can i change a tkinter variable from outside the class its made in?
class LoginPage(Frame):
def checkLogin(self,controller):
caller = MenuPage(self,controller)
caller.setUserInfo()
class MenuPage(Frame):
def __init__(self,parent,controller):
Frame.__init__(self,parent)
self.infoVar = StringVar(parent)
self.infoVar.set("first str")
label1 = Label(self,textvariable = self.infoVar)
label1.pack()
def setUserInfo(self):
self.infoVar.set("second str")
in the code above, i need infoVar to be "second str" but its still "first str" ty in advance
Guys, just a beginner question about tkinter:
What exactly the **update_idletasks() **function does? Any examples?
Hi, I have a self.ui.spinBox and I would like the value of the spinbox to be set as the font size for the whole app. I have this line of code to grab the value, and it works perfectly value = self.ui.spinBox.value() but I cant figure out how to change the font size. Thanks, Famous8
iirc you can use stylesheets to set the "font-size" to something. (Assuming this is PyQt5) @unique forge
sorry i didn't really explain
why you make Stringvar() there is another way better to change the text of widgets
sorry i didn't really explain
@crystal sentinel no problem
oh is there another way?
ok thankk youu i will look into that
You're welcome
class LoginPage(Frame):
def checkLogin(self,controller):
caller = MenuPage(self,controller)
caller.setUserInfo()
class MenuPage(Frame):
def __init__(self,parent,controller):
Frame.__init__(self,parent)
self.label1 = Label(self,text = "First Text")
self.label1.pack()
def setUserInfo(self):
self.label1.configure(text="second text")
hmm i still have the same problem
it works if it call it from the same class, but not from a different class
i think its because the self is different?
can you screenshot for error please
you mean error not defined?
or another error
hello?
@crystal sentinel
theres no error, the text just doesn't change
because you doesn't call the function correct
oof
im not sure what you mean
I think there is no problem with you'r code
but
you don't make -master option actually no problem but maybe from this because I don't see any problem
stranger
hmm
maybe you want to make timer then run the function
timer = w.after(time, callback)
w is var
what would that do though?
wait time then run the func
class LoginPage(Frame):
def checkLogin(self,controller):
caller = MenuPage(self,controller)
caller.after(20, setUserInfo)
class MenuPage(Frame):
def __init__(self,parent,controller):
Frame.__init__(self,parent)
self.label1 = Label(self,text = "First Text")
self.label1.pack()
def setUserInfo(self):
self.label1.configure(text="second text")
setUserInfo not defined, not sure about that
ah
just add caller. befor it
class LoginPage(Frame):
def checkLogin(self,controller):
caller = MenuPage(self,controller)
caller.after(20, caller.setUserInfo)
class MenuPage(Frame):
def __init__(self,parent,controller):
Frame.__init__(self,parent)
self.label1 = Label(self,text = "First Text")
self.label1.pack()
def setUserInfo(self):
self.label1.configure(text="second text")
no errors, but it still didn't work
hmm
indeed
@whole dagger how can I use Style Sheets?
You can try spinBox.setStyleSheet("font-size: 20px"). Alternatively something higher/lower than 20 if that's what u want
I have a very odd problem. I've been using blessed for a while to colorize terminal output. But when I import either librosa or pytorch, the colorization doesn't work and I'm stuck with 16 colors.
edit: nvm, I figured it out. Somewhere along the import process stdout and stderr were being replaced by some wrappers that don't work well with blessed. py sys.stdout = sys.__stdout__ sys.stderr = sys.__stderr__
fixes it
I am trying to use PyQt5? But I am having some problems "Undefined variable 'QApplication', 'Undefined variable 'QPushButton' and 'Undefined variable 'QMainWindow' what do I do?
import them
@uncut pawn please send the code
@whole dagger what if I want to set the font size to a variable
also im trying to change the font size for the WHOLE entire app
what module you're using?
ok
do this
from PyQt5.QtWidgets import (QApplication, QMainWindow,)
from PyQt5 import QtWidgets
replace it
all
with the top two lines
k
no it did not
here
dont import QPushButton
it still has the same problem
@unique forge you can set the stylesheet for your main widget, if you want a global font size
ok
And what do you mean by set the font size to a variable?
What about me
run the code
And you want value to be the font size of your application?
it does not work
Traceback (most recent call last):
File "c:\Users\Owner\Downloads\GUI\GUI2.py", line 44, in <module>
window = Window()
File "c:\Users\Owner\Downloads\GUI\GUI2.py", line 17, in init
self.UiComponents()
File "c:\Users\Owner\Downloads\GUI\GUI2.py", line 26, in UiComponents
button = self.QPushButton("CLICK", self)
AttributeError: 'Window' object has no attribute 'QPushButton'
yes
how do I do that
does not work
also there is a easier way to create GUI's
you can install QT Designer
which is a drag and drop interface
which does all of this code fore you
you seem like a beginner
I am
and QT Desinger would be very helpful for you
BUt I want to learn HOw to code
Will I use Tkinter and made a interface
Tkinter is good
NOt I just Started with PyQT5
Basically what you need to do is
widget.setStyleSheet(f"font-size: {value}px") where widget is your central widget of your app. ( @unique forge )
I want to code
I think so
because you didnt seem to know what importing is
Do I use pip install Qt Designer
let me send the link
@uncut pawn
@whole dagger when I change the value of spinbox, the font doesnt change, instead it shuts down the app
Do you call a function when the value is changed?
yes
self.ui.spinBox.valueChanged.connect(self.fontChange)
def fontChange(self):
value = self.ui.spinBox.value()
widget.setStyleSheet(f"font-size: {value}px")
@whole dagger
Well, widget is supposed to be your central widget, I just named it widget because I don't know what yours is named
You most likely have one. Did you generate your code using designer?
its called centralwidget
Yeah
Try doing self.centralwidget instead of widget
ok
and put an ; at the end of your string
Sure
I have a copy button
that should copy the text in a variable
here is the code
def copysqr(self):
clipboard = QApplication.clipboard()
clipboard.setText(s2)
but again
the app shuts down
every time I press the button
actually, i need help with a lot of things
what OS?
Windows
its the same app you helped me develop a while ago
what does !help have to do with this
what are you doing
please stop
clipboard.clear(mode=clipboard.Clipboard)
setText(s2,mode=clipboard.Clipboard)
Things I want to do. 1. Create a Layout in QT Designer without changing the location of all the widgets 2. Make the QLineEdits expand or resize to the length of the text 3. Make the copy buttons work
@quasi slate what are you doing
please stop
why do you keep doing !help
Look at #โ๏ฝhow-to-get-help
ok
but thats not how you do it
you take a available help channel
instructions here: #โ๏ฝhow-to-get-help
@eager beacon I added the new code but it still shuts down the app
def showsqr(self):
s1 = float(self.ui.lineEdit.text())
squared = s1*s1
s2 = str(squared)
self.ui.lineEdit_2.setText(s2)
@eager beacon the code
oh
@quasi slate why are you back
get a help channel
and ask your question there
thats not how you get help
@eager beacon what should I do
should I make a new variable
copys2 = s2
that won't work either
it needs to be self.s2
or you need to accept an argument in the copy function
and pass the text to copy on press
I actually shouldn't have said or
the variable needs to be saved some how and self.s2 is the easiest way
im back
should I do ```py
clipboard.clear(mode=clipboard.Clipboard)
setText(self.s2,mode=clipboard.Clipboard)
@eager beacon
yes
the code ends again
and the app shuts down
def copysqr(self):
clipboard.clear(mode=clipboard.Clipboard)
setText(self.s2,mode=clipboard.Clipboard)
the code
@eager beacon
show me setText
?
setText
what about it
oh
ha
it still doesnt work
it still shuts down the app
without copying the text
@eager beacon
def copysqr(self):
clipboard.clear(mode=clipboard.Clipboard)
clipboard.setText(self.s2,mode=clipboard.Clipboard)
thats because you removed clipboard = QApplication.clipboard()
oops
still doesnt workk
def copysqr(self):
clipboard = QApplication.clipboard()
clipboard.clear(mode=clipboard.Clipboard)
clipboard.setText(self.s2,mode=clipboard.Clipboard)
lets see showsqr
def showsqr(self):
s1 = float(self.ui.lineEdit.text())
squared = s1*s1
s2 = str(squared)
self.ui.lineEdit_2.setText(s2)
@eager beacon
any suggestions
it worked!
thank you so much
I now want to complete these tasks
- Create a Layout in QT Designer without changing the location of all the widgets 2. Make the QLineEdits expand or resize to the length of the text
@eager beacon
I don't use QtDesigner often so I can't help with that
ok
i guess you could use self.line.fontMetrics().width(self.line.text())) to set the width in a function that connects to textChanged
then in the function use self.sender() instead of the specific self.line
ok
just to clarify
you will need to refine that
well for one that doesn't set the width of anything
ok
it only returns the width of the text
how would I set the width to the length of the text
and 2, i don't think you want to enter an empty line edit thats 200 pixels wide and type a letter and have it shrink down to 2px
same way you set a width on any widget with the code i sent you as the width
I guess I will leave those things for the next update
what is you'r problem @unique forge ?
yeah
ah sorry
its fine
๐
@eager beacon do you know how to create a layout without QT Designer
in tkinter, how do i put an image over a checkbox?
Can anyone solve this problem
is the code not workng?
hey, can you open qt designer even after you convert to the code? it wont let me
ping pls if you have an answer
@digital rose what is the problem
Does the app not open?
How do you convert the ui file
I translated the code to python on pycharm and I cannot retouch the GUI in qt designer
Yessir
So you used pyuic5
What OS?
And what happens when you open QT Designer
@digital rose
Hmm
Why did you close it in the first place?
Also im not familiar with Mac
So Im not sure if I can help
are you using the .ui file?
Because QT Designer should open
Iโm not quite sure, Tbh
Yes
And it worked
restart your computer
qt creator and designer bug out in weird ways
I donโt see why i would have to restart my computer
i just told you
QT designer isnt working
Restart it
And it should work
There is some bug
Restarting fixes 50% of PC bugs
turning it off and back on fixes more things than you'd think
Yeah
So many things happen
Once I thought I lost all my data
Restart
And boom everything is in working order
im am trying to recreate this game and was wondering what would be the most efficient way to make the buttons in tkinter?
is pyqt better than tkinter?
Can't get mouse.move to work anymore and the mouse.click hasn't worked at all? Would there be a better way to code it or?
oh
why don't you try moving it under the sleep to see what happens
I don't know if it will or not
k
no idea how its implemented
If not should I swap to pyinput?
New to Python so not entirely sure what to be using
you would need to significantly change your code if you did
so may be best to get this working if possible
kk
have you tested outside a loop clicking on things to see if it even works on your machine?
I would
in tkinter, how do i put an image over a checkbox?
@digital rose-imageoption
is
pyqtbetter thantkinter?
@next hare maybe
some things is not in pyqt and another things is not in tkinter
as beginner the tkinter is better
Restarting fixes 50% of PC bugs
@unique forge only on windows though
hey I was wondering if I could please get help with my code in tkinter?
in tkinter, if you need to tell the user something, like "Enter text here: ", and never use the label again, is it fine to just declare it?
You mean
Delete Label ?
@digital rose
no
i mean is it ok to just do Label() if u wanna put some text on the screen
or to store it in a variable
in my code, it is telling me that "No name 'QApplication' in module 'PyQt5.QtWidgets'" but it works so what do I do?
here is my small code
I uninstall PyQt5 and reinstall it. upgraded pip and it still tells me that "No name 'QApplication' in module 'PyQt5.QtWidgets'"
Should I use pyqt or tkinter?
Im leaning towards tkiner, but I haven't touched either yet
Tkinter is easy to use But PyQt5 has more options
like what options?
U can use Pyqt with Css
Since I haven't used pyqt or tkinter, I don't know how useful that is lol
Css is a programming language that bassically makes your app look better
BUt I think start with Tkinker it is easy
alright thx
np
oh, I didn't realize Pyqt requires a license to use commercially
free for open source commercial use
free for individual use
Not free for commercial use
View answer 2 https://www.quora.com/Is-PyQt-free-for-commercial-use
However, it seems like pyside is very simmilar to pyqt https://pypi.org/project/PySide2/
i'm quite new to python and i've been using tkinter for my UI's is there anything else i could use? something else a little more clean and sophisticated?
@slim bronze i have been using wx.python for a few months now
its quite powerful in my experience but i have never used anything else
.
.
side note: reason I came here is i am getting a weird issue in pyinstaller when i terminate my program it doesn't clean up the temporary files. does anyone have a fix for this?
ah ok thank you iโll have a look into it
sure feel free to ping me i may have encountered an issue you run into. kutiekatj9 was also a massive help to me early on when working with it but i cant offer up her help myself. she definatly just seems like one of the more expirenced people in this channel
ok thanks, the only thing i can suggest with my extremely limited knowledge is maybe using โonefile but itโs probably not the fix youโre looking for
ty yeah i thought of that but I think --onefile doesnt make an impact when you use a .spec file to specify all the properties
@slim bronze theres also like PYQT5 or something i think thats similar but idk what it is tbh
oh ok iโll have a look at that too
and thanks for the help, sorry i couldnโt help you more
all good im going to keep looking into it and maybe someone else will come along who has some useful info. worst case senario is i stay up real late tonight so i did not lie to my boss on when this will be fixed by xD
๐
HOw to use multiple files in PyQT5?? So like 1 file has a window and the other has a button put on the window does anyone know how to do that?
@uncut pawn did you use QT Designer
NO I found the problem. It was in the Pylint and coded some C code and done. It now works
@unique forge
is there way to make a simple drag-and-drop interface?
hello , i am a beginner for python and want to learn it . can u tell me with what and where should i begin ?
@upper coral Start of knowing the basic of programming.
Creating Variables
If ... Else
for loop and While loop
OK , so after downloading python i have to do that
k
thanks
thank u very much
np
or to store it in a variable
@digital rose ah
.configure
from tkinter import *
root = Tk()
def clicked():
GG_Label.configure(text="Changed :D")
GG_Label = Label(master=root,text="GG")
click_change_btn = Button(master=root,text="Click to change the GG text")
GG_Label.pack()
click_change_btn.pack()
# To call func
click_change_btn.bind("<Button1>", clicked)
root.mainloop()
nevermind
how can i delete a widget inside a stacked widget
doesn't seem there's any option for doing so
nevermind
@digital rose sorry
I take a while to answer you
sorry
doesn't seem there's any option for doing so
@vague gale?
well, i can't see how to delete it
just doing except:seems to work
well, i can't see how to delete it
@vague gale is this made with tkinter
no that's qt designer
@digital rose can you help me in tkinker
I'm trying to settle on which GUI library to use for a project of mine, it's a chemistry software that's trying to optimize values from experimental data; the user inputs initial data into a form (a quite big one) and then launches the calculation itself.
I'm looking for some kind of framework that can allow me to use read-write tables that can be used as inputs and can be modified in number of rows/columns when the input for that is changed. Some input fields also needs to be disabled if some conditional inputs are checked and I would like to have this happening on the fly kind like it's possible in a reactive envoirment such as RShiny.
Is there something that could appeal to me given my requirements?
@cosmic nymph I suggest using Pyqt5 for this, and the gui wont take that long to implement either if you use the qt designer software. PyQt5 also has some widgets for displaying tables.
@vague gale If you still havent figured it out, what you can do is to use the buttons on the stacked widget to get to the widget you want to delete, then right click the stacked widget then you'll se an option "Page x of n", then there is a delete option there which u can click to delete it.
thanks @whole dagger
no problem
Has anyone here had any bad experiences with Dear PyGui? Or just good stuff?
someone who knows how to exit fullscreen in kivy.....because whenever i run the code it automatically goes to complete fullscreen....in which the entire screen is the output...i cannot see the taskbar nor anything...is there a way to prevent this
Trying to achieve the windows "fluent design" ui but this is what i got so far
The QtWinExtras.QtWin.blurBehindWindow doesn't seems to work on windows 10
But it does on windows 7
just set a QGraphicsBlurEffect as the widgets graphicsEffect
That would've just blurred the widgets, e.g slider, label, button, etc
But not the window
@plush stream How did you set the widgets alpha?
The main window?
Any of them
I just use the combination of QtWinExstras.QtWin.enableBlurBehindWindow() and self.setAttribute(Qt.WA_TranslucentBackground, True) to make the window translucent
That would've just blurred the widgets, e.g slider, label, button, etc
Actually, it won't even blurred anything
I can't seems to apply QGraphicsBlurEffect on QMainWindow
from PySide2 import QtWidgets
from PySide2.QtCore import Qt
class Widget(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super(Widget, self).__init__(parent)
self.setAttribute(Qt.WA_TranslucentBackground, True)
self.layout = QtWidgets.QGridLayout()
self.setLayout(self.layout)
This sets the alpha for you?
It wouldn't work without QtWinExtras.QtWin.enableBlurBehindWindow(self)
If you only use self.setAttribute(Qt.WA_TranslucentBackground, True) it will only make the window black
But it does on windows 7
@plush stream maybe it is not supported in windows 10 yet?
I think so too
and plus we also talked about this some time ago and like could not find any documentation as I somewhat remember you trying before
The blur effect seems to be activated by the window 7 aero theme
Well, there's nothing wrong with trying again
yeah
maybe something to do with the themes in windows 10?
you could try that maybe
That's what i'm trying to figure out
Windows 10 have aero like theme but i don't think pyside can access it yet
I wish there was a QTtt designer-like tool for Kivy's kv language
that would be so handy tbh
I didn't know tthat
can you send the link for i @bronze basin
QtCreator is a bit more powerful than designer so you may want to look at that also
just ask your question and someone will respond if they know the answer
To connect sqlite3 in python with tkinter it is necessary to use self or parameters?
And i have the database connected it works, I receive the data, but when I try to make it appear in treeview, it does not appear
if the method is in the a class and is not a staticmethod you will need to use self
Ooh i see
You'll need to post the code where your adding the data to the view for help with that one if it's not working
@bronze basin thats a link for QT Designer. He asked for a Kivy equvialent
@grim bronze oh sorry I misunderstood your question I thought you wanted a Qt designer app
my bad
You'll need to post the code where your adding the data to the view for help with that one if it's not working
@eager beacon where?
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.
I don't see where you are inserting any of the values
How can I add custom attribute to tkinter widget?
Yeah, I'll check it out in a few
can anyone here help me with a project of mine in tkinter please
i'm needing help with a school project
@unique forge why does this have pyqt5 and tkinter in the repo?
what do you think
its pretty neat
thanks
you should think about checking if square_lineEdit.isdigit() first and if it is using abs() on the sqrt
or cmath.sqrt
what is that
cmath.sqrt?
its for doing math on complex numbers
the functions returns complex numbers also
you could make a timer app that uses the QTrayIcon
make it so you can set the duration and start/pause/dismiss the timer from the tray icon
Thx
here is a recording of my program in tkinter, the problems in it are when the timer hits zero it doesnt display the next round and when you click on the correct color (that matches the background color) the timer doesnt reset and the round counter does not increase by 1 and when the timer hits zero it says X Timeout! but doesnt disappear when the timer resets, can someone please look at any of these problems and help me with any one of these problems that you know how to solve please and thank you!
as I am trying to recreate this game in tkinter http://kolor.moro.es/
@delicate tendon what is your code for the program?
hold up ill send you the link
@static cove are u still there?
when the timer hits zero it says/displays X Timeout! but doesnt dissapear when the timer resets?
You could always use GD3 itโs code uses nothing but English sentences and commands and turns that into a script for exactly what you want and compile, so it needs every detail in English information and it is a easy to use highly powerful popular expensive program and you could for example say
Create a social network similar to Facebook and Twitter merged together and then thatโs it. It would do it
An artificial intelligence created the software
It also is the software, who created the Artificial intelligence? Nobody knows
I certainly did not
when the timer hits zero it says/displays X Timeout! but doesnt dissapear when the timer resets?
@delicate tendon you make timer ? and can you send code ?
@delicate tendon are you arabic because you'r name is arabic
for some reason I cant send the link in the group chat so do I send it to you in dm's?
and no i am not arabic
yes and okay
https://youtu.be/PqbB07n_uQ4
According to the Sentinel artificial intelligence computer program GPT-3 machines have emotions
Tech featured in this video:
- Learn more about the GPT-3 API Here: https://openai.com/blog/openai-api/
- GPT-3 Paper: Language Models are Few Shot Learners - https://arxiv.org/abs/2005.14165
- Avatar for GPT-3 provided by Synthesia https://www.synthesia.io/
Resources for Ja...
That is the program I was talking about GPT-3
Hi
guys
I have q
in tkinter
How to make fixed position with the window of a widget in tkinter?
How to make fixed position with the window of a widget in tkinter?
@digital rose grid?
place
i havent learned place yet
i cant help you
hope you find your answer
yeah
can u
help me if I have grid
@digital rose welcome
ok so in tkinter i have an optionmenu and i want a function to run every time i select somethig else in that optionmenu, is that possible?
How to make fixed position with the window of a widget in tkinter?
@digital rose can't you do like place(x=23, y=44)
hi im new here
@digital rose can't you do like place(x=23, y=44)
@digital rose this is not what I want I want to make this changed when the size of the window is increased
hi im new here
@hybrid light welcome
ok so in tkinter i have an optionmenu and i want a function to run every time i select somethig else in that optionmenu, is that possible?
@digital rose wdym
so i have all of these options in an optionmenu
you mean you want to get if that button click
yes
.bind
sec
is that up label ?
its optionmenu
or combubox
ah this is menu
can u show you'r code ?
sure
its extremely untidy
thx
i mean menu part but yeah
the update function isn't complete
@digital rose so you found a solution?
you want -command
Why the heck r u pinging me everywhere
Hello! I don't know if this is the right channel to ask, but is there a library that you can use to make star reviews? or at least clickable text where when you click on it, some code will run.
You can ping me if you have answers, i will research on libraries
uMM
you want
-command
@digital rosefrom tkinter import * root = Tk() def print_hi(): print("Hi") things= list("1234567890") options = StringVar() options.set("LOL") optionmenu = OptionMenu(root, options, *things, command=print_hi) optionmenu.pack() mainloop()
its not working
@digital rose
apparently this worked optionmenu = OptionMenu(root, options, *things, command=lambda _: print_hi())
can i get a review on this "Homework manager": https://hasteb.in/jozefexu.rb
With Django vs Tkinter, which is better to use, when?
With Django vs Tkinter, which is better to use, when?
@spare ice django and tkinter are two different things. Django is for website dev while tkinter is for Gui
@digital rose can it be used for the Admin for Django? .... how often is GUI needed vs web with Django? Thanks!
Do you mean, web app with django and react or smthing similar vs tkinter GUI?
@meager skiff yes
ooh
well the answer is simple.
If you want something that looks very nice, potentially cross platform, and overall very polished, go with django and react. keep in mind they do take a bit of time to learn and implement
If you want something that just gets the job done, and basic GUI, well tkinter is your answer
or if you want kinda like the middle ground, you should check out PyQt
i think its native to PC platforms and it is more complex and flexible than tkinter
It should help you build a pretty good GUI. It has a lot of handy stuff like the QTdesigner and stuff
@meager skiff thank you. Well Iโve been using Django for a while now and I like it. It really helps to have a admin setup right away, and it seems to be more realistic with โstepsโ being simpler than what you do with React to make just a simple CRUD app.
@meager skiff is GUI in constant need of python? Or what part of python is in a stable demand that, you donโt need college for?
You can do a lot with python. But GUI? It has never been one of pythons strong points. PyQt is pretty good. But if you are more into GUI and frontend, i highly suggest Javascript, React and those kinda stuff
I'd say python has a lot of uses and a lot of stuff like machine learning, big data, server side stuff like django are very popular
but not gui
anything but gui
why not dive into linkedin or anyother job findnig website and take a look for youself
anything but gui
@meager skiff ok, but with machine learning, or anything thatโs a fairly stable precise demand, donโt you need college? Iโm familiar with react and vue, Iโm getting better at hooks
front end is a very popular sector, and if you ask me, i honestly have no idea what you need or dont need college for. If you are going front end though, invest in javascript
i love ui
?
Hi all, I cannot for the life of me remember the name of those scrolling news tickers on top of a website. What would be a proper name for that component?
For example, you go to a stock market website and you usually see how markets are preforming via the scrolling bar
no one knows what they're called
im trying to make a very simple ui for my work computer. I cannot directly install python on it. would tkinter be the way to go with using py2exe or should i go a different direction all together?
anyone here has experience with kivymd?
I am trying to import an image to my screen but dont know how... I tried googling it but which ever i try it gives an error or it just closes it self.
@cold cargo are you trying to make it a background?
are you doing this in kv or python?
putting an image in isn't really a kivymd specific thing nor do they have a simple just image component. the kivy way of doing it in KV would look something like this @cold cargo FloatLayout: Image: source:"img/IMG_2330.PNG" pos_hint: {'center_y':0.9, 'center_x':0.5} size_hint_x: 0.5
@cold cargo python would be something like this python myimg = Image(source='img/IMG_2330.PNG')
i want to made a small chat app with gui
and socket server but the problem here is
client server and ui have a single loop
and i cant connect them
because one of them will work and other will not ,
i tried Theard and its work but when i try to add text to gui form client server loop its say QObject::setParent: Cannot set parent, new parent is in a different thread ,any idea?
-pyqt5
i am trying to recreate this game http://kolor.moro.es/ and was wondering how I could make the score counter in this game in tkinter?
I am trying to learn PyQt5 and I come from Tkinter how does the button know which window the button is going to be placed. IN PyQT5
Hey guys. I am trying to make a website connected to my bot. When you hit sign in on the site, it redirects you to the ouath2 link for the bot ("The bot would like to access your username and profile")
etc
And I want the website to display the username and profile after logged in
My bot is in discord.py, I just dont know how to connect the bot to the site in terms of code.
oh hi
guys ho i verefy
?
how*
verefy?????
in voice room!!!
ah ok
chat*
;-;
anyone
you mean
what i do
any channel ? verefy?
what is your problem
in tkinter ?
This is not the place to ask.. Go to #voice-verification and make sure you meet the requirements @digital rose
etc
And I want the website to display the username and profile after logged in
My bot is in discord.py, I just dont know how to connect the bot to the site in terms of code.```
reposted question because it was somewhat burried
@frank snow So a website is a bit out of scope for this channel. #web-development might be a better option. Typically you would use a database as the connection between the bot and website. So the bot would access the database and so would the website.
I'm a bit inexperienced with OAuth portion of discord bots though.
Ah alright, thanks!
this is the problem i have
i want the 2 blank text fields to be directly below the red 'authorisation' label
but it seems to weirdly correct itself, i'm using grid
whats the grid
button = Button(root, font='Tahoma 20', width=10, height=2, text='Authorisation')
text1 = Text(root, font='Tahoma 20', width=15, height=1, bg='white')
text2 = Text(root, font='Tahoma 20', width=15, height=1, bg='white')
enter1 = Entry(root, font='Tahoma 20', width=7)
enter1.insert(END, 'Login:')
enter1.config(state='disabled')
enter2 = Entry(root, font='Tahoma 20', width=7)
enter2.insert(END, 'Password:')
enter2.config(state='disabled')
label = Label(root, text='Authorisation', font='Tahoma 20', bg='red', width=60)
label.grid(row=0, column=0)
enter1.grid(row=1, column=0, sticky='w')
enter2.grid(row=2, column=0, sticky='w')
text1.grid(row=1, column=1, sticky='s')
text2.grid(row=2, column=1, sticky='s')
button.grid(row=3, column=0, sticky='w')
Hmmmm try increasing the length of the red label
Or use place instead of grid
So you can use x and y coords
well, i'm doing a little course, and i have a homework that tells me to do grid instead of place
i did it with place already
Oh
increasing the length made the situation only worse
it seems to correct itself according to the label, but the label has to be full width of the screen
After column=0 write , sticky="n"
same stuff
i've tried playing around sticky
i guess there's just no good way to do this with grid
Yes grids even torture me,
But there will always be a way
It is just we are not able to figure out
Try using all the options you get in grid view
I've tried to read all sorts of documentation but still can't crack this one
Lol
well, guess i'll play around with grid some more
Hmm sleeping time for here sorry i couldn't help much even after having experience but someone will of course help
thanks for the help anyway
@next hawk yesss
It's just good to see that people help each other in the programming community
@next hawk are you going for something like this?
Then he can use sticky="e"
But i guess he wants it to be directly under the red label and completely towards west
Use .place much better @next hawk
lol
I am facing a similar issue as @pupsik. I am using pysimplegui to place 6 sliders. What happens is when the code is run, every slider is side by side. I want them to be one on top of another. What do I need to do?
Oh I literally just figured it out
What I didn't do was surround each SG.slider() with [], just the entire block. Adding the brackets fixed it.
Actually, new issue. Can I add a label to the side of a slider?
I'm on a roll, sorry for this flooding. I realized I can add SG.text() beside the slider code. I'm really new to python and coding in general. Sorry again.
Its ok lol
hello can someone help me fix a problem in my tkinter?
For that you need to post some code and your problem
Dont ask just do it
People will of course help
Hey ! I need help, I use Tkinter library and I want to create a label into a frame, but, when my label appear (he is called by a button), the frame is diseaperring ...
Thank you for your help !
||Sorry for this message, there is probably many incorrect sentences, im bad in english Xd||
Tell me if U need some code
Hi !
welcome
How can I tell to the Label to go into.the frame ? @digital rose
place it on the frame I mean place the frame .place first then place the Label
I have found the solution ! I juste had to do a .pack_propagate(False) ! Thank you very much for your help !
You'r welcome
{Pyqt} does anybody know how to change the size of the circle of QRadioButton? i tried this method, setting the stylesheet but it's not working, it does decrease the size when i set the width to 12 and height to 12 but it's not increasing the size
QRadioButton::indicator { width: 30px; height: 30px;}
Hi, I am trying to create a tkinter label (left) and button (right) for every item in a list. How do I do this?
Never mind, I got it working by putting the labels in a list and looping through the list to pack them
I'm currently creating a small pokemon game where your suppose to track scores, the problem is when the player loses or the AI loses both side loses points instead of only one
these are my set of code
def button1():
global playerChoice
playerChoice = 1
showResults()
showComputer()
gameArea.update()
def button2():
global playerChoice
playerChoice = 2
showResults()
showComputer()
gameArea.update()
def showComputer():
global compChoice
compChoice = random.randint(1,2)
showResults()
def showResults():
global playerChoice, compChoice, onixHealth, userHealth
if playerChoice == 1 and compChoice == 1:
gameArea.itemconfig(message, text = (playerName," uses tackle and Onix uses Hard! PLAYER WIN"), font = ('courier new', '10'))
onixHealth = onixHealth - 1
gameArea.itemconfig(cScore, text = onixHealth)
elif playerChoice == 2 and compChoice == 2:
gameArea.itemconfig(message, text = (playerName," uses Growl and Onix uses Slam! PLAYER WIN"), font = ('courier new', '10'))
onixHealth = onixHealth - 1
gameArea.itemconfig(cScore, text = onixHealth)
elif playerChoice == 2 and compChoice == 1:
gameArea.itemconfig(message, text = (playerName, " uses Growl and Onix uses Harden! PLAYER LOSE"), font = ('courier new', '10'))
userHealth = userHealth - 1
gameArea.itemconfig(pScore, text = userHealth)
elif playerChoice == 1 and compChoice == 2:
gameArea.itemconfig(message, text = (playerName, " uses Tackle and Onix uses Slam! PLAYER LOSE"), font = ('courier new', '10'))
userHealth = userHealth - 1
gameArea.itemconfig(pScore, text = userHealth)
the player lost 2 points for some reason
no
who about just coding it in Pyqt5
Guys How can I make scrollbar in tkinter ?
Python - Tkinter Scrollbar - This widget provides a slide controller that is used to implement vertical scrolled widgets, such as Listbox, Text and Canvas. Note that you can also create hor
here
Here is example:
from Tkinter import *
root = Tk()
scrollbar = Scrollbar(root)
scrollbar.pack( side = RIGHT, fill = Y )
mylist = Listbox(root, yscrollcommand = scrollbar.set )
for line in range(100):
mylist.insert(END, "This is line number " + str(line))
mylist.pack( side = LEFT, fill = BOTH )
scrollbar.config( command = mylist.yview )
mainloop()```
If anybody has time for Tkinter please check the germanium chat, my questions are there
hey how would I make that when I stretch the size of the window of maximize the window size how would I keep the positioning the same of the labels and buttons on the window in tkinter?

