#user-interfaces
1 messages ยท Page 63 of 1
hi
I have written a personal assistant application in python. I want to add an interface to this
but I don't ฤฑmport in my project
I used PySide2 to attach GUI to my application
There are many different frameworks, PySide2 as mentioned and PyQt5, which is a wrapper for the Qt framework. tkinker is another one but I have no experience with that once.
but if you want it simple and fast to make i am guessing tkinker is your best bet, I have been trying to learn PyQt / Qt for a week now and there is alot to learn and the information documentation isent allways the best
how do I transfer data (like text) from one place to anothor with something like the socket import, Sourse code whould be greatly appreaciated
It seems like #networks and maybe give more details
ok thanks
Star Gym is a network of many excellent gyms where you can find modern exercices machines, ladies & wellness zone, great community and trainers.
someone can tell what should be better?
What do you recommend to use, Tkinter or PyQt?
Because I'm new to GUI.
And I don't know which library is better.
What's the easiest?
Tkinter is probably easier than PyQt
But what's the difference between the two?
but you can do more advanced and cool stuff using PyQt
both are different GUI frameworks
there are many
like PySimpleGUI, Tkinter, PyQt, etc
Yeah. I'm kind of new to Python so I don't know a lot.
But thanks man. I'll try Tkinter cause I just wanna experiment around.
Hey guys. Anyone familiar with PyQt and shortcuts? I'm trying to make a shortcut T+1. but having problems.
self.track_button_sc = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_T), self) #WORKS
self.track_button_sc = QShortcut(QKeySequence(Qt.CTRL + Qt.Key_1), self) #WORKS
self.track_button_sc = QShortcut(QKeySequence(Qt.Key_T + Qt.Key_1), self) #DOES NOT WORK
Hey guys, I'd like to learn how to learn how to make a modern ui, anyone could suggest me some ways so that I can study them?
i want to make a new label every time i click a button at changing y axis, how would i go about doing this is i want to save the coordinates so that if i open it again the a new label will be made but it will be relative to the previous labels i made in the first run?
this is using tkinter
i wanna know a general idea like how would u tackle this problem?
Hello all, I actually want one of my image tag in web page to move down on scrolling.
I referred to many online sites but I am not able to fix that.
Can anyone please guide me here.
I want that bike to move down on scrolling
hi i would like help with kivy-ios
Im trying to package my app for ios and when i run toolchain build python3 kivy i get the following error
[DEBUG ] /Users/rehatbir/Dev/Python/STEM-Project/build/hostpython3/x86_64/Python-3.8.2/Modules/posixmodule.c:9197:15: error:
[DEBUG ] implicit declaration of function 'sendfile' is invalid in C99
[DEBUG ] [-Werror,-Wimplicit-function-declaration]
[DEBUG ] ret = sendfile(in, out, offset, &sbytes, &sf, flags);
[DEBUG ] ^
[DEBUG ] 4 warnings and 1 error generated.
[DEBUG ] make: *** [Modules/posixmodule.o] Error 1
[DEBUG ] make: *** Waiting for unfinished jobs....
@deep marten Couple months ago I was in a similar situation. Looking for a GUI framework that was simple to use. I cam across PySimpleGUI https://pysimplegui.readthedocs.io/en/latest/ - the site has lots of documentation and examples to guide you. Here is a screen shot of my first app with pySimpleGUI.
None
I have intentionally masked certain part of the screen
Do you guys know how to package a kivy application for android?
thanks u so much!
@lethal eagle Pysimplegui is a nice module and everything is well explained but It's a bit tricky to get data from Pysimplegui like if you need the data of a button that is typed then it's simple but you won't straight overthink it because I have experienced that. Yeah.
Hey, would anybody look at my app and tell me is this text readable?
You can see that I used a table to display menu options, but for the rest of the program I'm using normal text. Is there something I can change to "make this look better"?
Maybe see if it looks better centered?
Centered? I don't think that would look "normal". You can see that each line holds a message with input from the user. Can I do something do make it look better, or is it fine the way it is?
I'd say its fine, I was thinking about centering the lower text initially (before noticing the inputs) could still center the title/logo. Could use colours I suppose if you really wanted, but looks fine as is.
Yea, I might consider adding colours to messages inserted by user. Thanks
You can force the inputs over as well, so they're lined up. Would be a similar procedure to how you'd center.
Sorry, I don't follow. What do you mean by forcing inputs over? Sounds interesting
Just padding. Say : <50 or whatever it may be on all them and itll fill til 50 with spaces
!d str.format
str.format(*args, **kwargs)```
Perform a string formatting operation. The string on which this method is called can contain literal text or replacement fields delimited by braces `{}`. Each replacement field contains either the numeric index of a positional argument, or the name of a keyword argument. Returns a copy of the string where each replacement field is replaced with the string value of the corresponding argument.
```py
>>> "The sum of 1 + 2 is {0}".format(1+2)
'The sum of 1 + 2 is 3'
``` See [Format String Syntax](string.html#formatstrings) for a description of the various formatting options that can be specified in format strings.
Note... [read more](https://docs.python.org/3/library/stdtypes.html#str.format)
So either the format string syntax, or .ljust
Does anyone have a good source on how to connect a python bot with a web interface
Hi
I use pysimplegui
And after my coding is done, i convert it to .exe with auto-py-to-exe
But when i press cancel at my script
It says Failed to execute myfile.py
Please ping me for answer.
actually when I import the math library, pycharm shows it in dark grey colour (no significance), it works well with pygame and random library but as soon as I import any other library, it shows it in dark grey colour
no, it shows all other part of code in dark grey
except that was written earlier
leave m doing it in IDLE, pycharm is confusing
I think I might be doing this wrong...
I made a gui with PyQt5 designer. Then I converted it to a .py file with PyUIC. Now I've been adding functions and connecting the buttons in the in the same .py file
Does tkinter have a way to resize widgets as you resize the main window?
@digital rose Which Geometry Manager are you using.
๐ โ
@digital rose well if you're a beginner then go with Tkinter otherwise go with pyqt
Iโm using tkinter and was wondering how you can add a line to a canvas after already packing it
I tried doing canvas.pack_forget(), adding the line, and then canvas.pack()
but that didnโt work
how long did that take? cool shit btw
Not long. Learning how to do it is what takes so long.
Took me about 5 hours total including researching how.
I could recreate it in 15 minutes.
wew
I could teach you in less than that though.
use the buildozer package it automates the process
buildozer automates the process of manually downloading python-for-android dependices, java sdks, and java jdks or whatever it is called
@north ore yes i tried that but loads of errors come whenever i use like a tutorial on yt or some web
Buildozer is pretty rough you will run into errors eventually
i managed to fix mine, with some expereince. One thing to note is do not use the PyPi version of buildozer
Hello! i have a question , i have installed Pillow ( PIL ) but whenever i try to use it i get an error saying theres no module called PIL. how can i fix this?
anyone?
Run the install in that terminal, does it say already installed?
yeah
it does
it says that its already installed.
@tribal path (sorrry for the ping , i need help asap kinda)
Can you post a screenshot showing that? Somehow must be different pythons still
Yea thats 3.8, the terminal above is using 3.9
py -3.9 -m pip install pillow should do
its not giving an error anymore!
thank you so much.
im still a beginner so if i have any questions ill be making sure i ask them here, thank you so much <3
np. What you had there is pretty common, just due to different python.exes being used
def clicked(bt):
resultl.configure(text=bt)
btOne = Button (window, text="1", command=lambda: clicked(btOne))
btOne.grid(column=1,row=1)
how do i get the value of the button's text?
in tkinter
bt.text ?
i tried it says AttributeError: 'Button' object has no attribute 'text'
Any reason for passing (btOne) instead of ("1")?
yes it's dynamic
but i found the solution
bracket notation instead of dot notation
def clicked(bt):
resultl.configure(text=bt["text"])
thanks tho
actually idk why i didn't do that instead of passing the variable
Hi. Is there a way to hide the minimize and maximize buttons on a window in PyQt5? something like this:
It is incredibly annoying that you cannot use the fill attribute when using grid() in tkinter.
With grid I can control exactly where widgets go, with pack it's more annoying process to have to track down where a widget fits into the grid.
but pack lets me use the fill attribute...
_<
tkinter is so disappointing.
it's really great and easy.. but how can you not pack into a grid? that is an insanely important thing!
I am not sure how to move forward. This is a big problem not being able to pack widgets into a grid.
I think I found a workaround. Pack 3 frames with side=left, then pack 3 labels in each frame and they will stack vertically. this will create the illusion of a grid. I'll try and post results.
I finally made a grid using pack. It looks pretty nice and also scales when you resize the window.
import tkinter as tk
def main():
Root = tk.Tk()
Root.title("Packed 3x3 Grid")
Root.geometry('1366x768')
C1 = tk.Frame(Root, bg='gray', borderwidth='1')
C1.pack(side='left', fill='both', expand='true')
C2 = tk.Frame(Root, bg='gray', borderwidth='1')
C2.pack(side='left', fill='both', expand='true')
C3 = tk.Frame(Root, bg='gray', borderwidth='1')
C3.pack(side='left', fill='both', expand='true')
C1R1 = tk.Frame(C1, bg='gray', borderwidth='1', relief='groove')
C1R1.pack(fill='both', expand='true')
C1R2 = tk.Frame(C1, bg='gray', borderwidth='1', relief='groove')
C1R2.pack(fill='both', expand='true')
C1R3 = tk.Frame(C1, bg='gray', borderwidth='1', relief='groove')
C1R3.pack(fill='both', expand='true')
C2R1 = tk.Frame(C2, bg='gray', borderwidth='1', relief='groove')
C2R1.pack(fill='both', expand='true')
C2R2 = tk.Frame(C2, bg='gray', borderwidth='1', relief='groove')
C2R2.pack(fill='both', expand='true')
C2R3 = tk.Frame(C2, bg='gray', borderwidth='1', relief='groove')
C2R3.pack(fill='both', expand='true')
C3R1 = tk.Frame(C3, bg='gray', borderwidth='1', relief='groove')
C3R1.pack(fill='both', expand='true')
C3R2 = tk.Frame(C3, bg='gray', borderwidth='1', relief='groove')
C3R2.pack(fill='both', expand='true')
C3R3 = tk.Frame(C3, bg='gray', borderwidth='1', relief='groove')
C3R3.pack(fill='both', expand='true')
Root.mainloop()
main()```
the sauce
a packed grid is a little better than a regular grid, because pack() allows you to fill and expand, while a grid() does not.
IMHO
Ok, apparently I was completely wrong and that is shit. If you pack stuff into the frames, they just change size because of expand. I give up.
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:
This is the final version. Idk. Do what you want with it. It works, but it's finicky because the expand reactions to when you pack new widgets into the rows.
An example of a text box placed in column 2 row 2
It's actually not bad, considering it sort of flexes to what you put into it. I am sure it can be adjusted.
Another tip... you can change the interpreter you are using by changing its path with VSCode's UI (I saw you were using it)
It
Using what?
It's in the bottom-left corner.. If yuou click that box that says "Python 3.x.x..." You can select what python interpreter you want to use
I was responding to someone else
OOPS!!!
hey does anyone know whats better for begginars, pyqt or tkinter
and from where can i learn them
I havent had any experience with them
But you could use Visual Studio
or if you want simpler, use Visual Studio Code
@thin ore i tried those options but none of them work
@woeful niche Can you show what you have ?
Perhaps you should claim a help channel for that.
pyqt is the best
one
it has QT Designer (drag and drop)
QtQuick is amazing
@unique forge do you know of any tutorials from yt or blogs for PyQt5 - modern gui
Like more advanced than standard operations
Custom buttons etc
@modern marsh pyqt5 isnt modern???
also, I dont have a tutorial sorry
QtQuick is amazing
hi
`from tkinter import *
screen = Tk()
screen.title("Remainder Setter")
screen.geometry(20 * 30)
entry1 = Entry(screen, width=50)
entry1.pack()
def myclick():
mylabel = Label(screen, text="Remainder: " + entry1.get())
mylabel.pack()
btn = Button(screen, text = 'Save remainder', command=myclick)
btn.pack()
screen.mainloop()`
what is the error
๐
looking
Hi, can anyone tell me what i can do to fix this? basically what im doing is im putting all the jpg files in my folder into a list , and then im making a button which when clicked goes thru the list by +1 and shows the next image , what can i do to fix this?
the error btw
@coarse dew Unfortunately ,There is no good course on Pysimplegui but I think the documentation they have is nice and you can easily pick up it so try your best and search for any YT Tutorials .
can anyone help?
Do you know a good course for TKinter?
@coarse dew yes
Hey, I am trying to get python code to 'production' - in the sense that I want clients to just be able to run 'main.py' without too much effort. I know I can create an executable, but what are other clean ways to do this?
the file needs access to local storage
for instance, is py2exe recommended if I want to give it to clients? (security-wise etc)
can anyone help?
@hushed sorrel thing is i want the button
to go thru the images in the list
so i did +1 meaning the index should be added by 1
what do you think i should do?
this gives an errro too
can anybody help?
as far as i know, grid and pack cannot be used together. Use place or pack instead of grid
ok
how do i make custom buttons in QtDesigner
@modern marsh What do you mean by customized button?
anyone who thinks Qt Designer isnt very modern, check out Wandersons YT channel
he has amazing skill, his UIs look amazing
and he uses Qt Designer and PyQt
@modern marsh https://youtu.be/NqaEQT_F-8Q
๐ PATREON:
Many people asked me to create a Patreon (thanks to everyone, you are amazing โค)!
If you can help me keep creating new videos about technology and that amount will not be missed for you this will help to share knowledge FOR EVERYONE!
https://www.patreon.com/WandersonIsMyName
๐ DISCORD: https://discord.gg/WufW3ZHZyX
A time lapse show...
oh
i saw his qtquick stuff
had no idea he does this too
thanks a lot :))
why do i feel like QtDesigner is easier to use than QtCreator
From a UI file design perspective its pretty much the same but creator has a ton of features that designer doesn't.
Its a complete IDE for Qt, a Qt Documentation viewer, It has a library of sample code examples you can build/read, etc
I think you can even use the IDE for PySide2 projects now
nice
one more thing
can I access .ui files inside the design editor in qtcreator
like, qtdesigner makes .ui files
but qtcreator does .qml ones
which i am not very familiar with
creater does .ui files too
oh
I don't know if I'd say it had more features but some features in QML are easier to implement that they would be using QtWidgets
If anyone has trouble running their program using tkinter, it's because mainloop is blocking. Use update() to allow your program to run with it.
import tkinter as tk
Root = tk.Tk()
Root.title("Without mainloop")
Root.geometry('1366x768')
TextBox = tk.Text(Root)
TextBox.pack()
loopActive = True
while loopActive:
Root.update()
if not loopActive:
Root.quit()
else:
#do thing```
idk if this applies but im trying to make it so the user can input a text and then tts will speak it. I downloaded gtts btw:
from gtts import gTTS
import os
List = input("Write your list")
myText = List
language = 'en'
output = gTTS(text=List, lang = language, slow=false)
output.save("output.mp3")
os.system("start output.mp3")
i beg of u guys
from gtts import gTTS
ModuleNotFoundError: No module named 'gtts'
thats the error
Pls ping me if u have an answer
So I am using Qt Designer to make the layout forms for my program.
I transform the ui files into py code pyuic. I dont edit the Forms produces but load them in a custom class with their setupUi(). All good so far.
But I was wondering if its feasible to make context menus with Qt Designer also, or if I should just hand code its layout in my CustomView classes?
Hi. What's the best way of displaying text into PyQt5? I use QLabel and then with setText('some text') I write the text I want, but I notice you can use HTML syntax for it. Is it good to use it? Because I find it easier using HTML syntax. The bad thing is that the string gets longer and longer, so I don't know if it's really the best approach
Hi Can anyone give me some insight into whats causing this error ? Im using Django 3.1.4 and python 3.8.6
Hey @proud rapids!
It looks like you tried to attach file type(s) that we do not allow (.pdf). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.
Feel free to ask in #community-meta if you think this is a mistake.
Hey @proud rapids!
It looks like you tried to attach file type(s) that we do not allow (.rtf). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.
Feel free to ask in #community-meta if you think this is a mistake.
Hi Can anyone give me some insight into whats causing this error ? Im using Django 3.1.4 and python 3.8.6
trying to do a project from testdriven.io
is it possible to have a bitmap button in the same place that i have text boxes
like the text boxes are on top of/inside of the bitmap button bounding box?
I'm making a app with PyQt5 and want to open file manager, so I can choose a folder, and then I will os.chdir to that directory
how can I open file manager and save the path chosen in a variable?
If anyone has any insight this is what i am hoping to acheive
basically a button that i can have editable text on top of
how does it relate to web development I am building a desktop GUI with wxpython?
@proud rapids thats not a GUI question, its a #web-development question
Django is a website framework
ah
Hi, I'm trying to make an app for my friend. It will be a gift for her to cherish our past relationship. It's probably going to be a simple app, where there's the main menu accompanied with some buttons. The buttons will take the app to a new window depending on the button clicked. For example the first button is simply for my message to her. The second button is for my favorite pictures with her. The third one is for my favorite memories with her. I'm a 1st semester CS student and I've only learned Python, with basic understanding of Tkinter. If anyone knows the easiest way to create the app please do tell me. It doesn't have to be coded, maybe there's an app that can help me realize this. Or if you're free and are willing to help me please kindly DM me, Thank you!
in tkinter you can use tk.filedialog
in PyQt however , idk
perhaps you can implement a bit of tkinter in your app?
@modern marsh ```py
self.path = QtWidgets.QFileDialog.getExistingDirectory(None, 'Select Music folder:', 'F:\', QtWidgets.QFileDialog.ShowDirsOnly)
@shrewd mauve you should use PyQt5 with Qt Designer
and use stacked widgets
thanks :))
Do you think it's hard to learn PyQt5 for a beginner? I've looked at the code example and I barely understand it.
I don't even know how to create a program that calls multiple .py files.
Alright thanks I'll try learning it, do you mind if I DM you for help later?
sure, DM me
just import it
i see, shouldn't be that hard.
Thank you so much
yeah qtdesigner is easy
doing it all manually tho is tough
but even then, to do a basic - tkinter like styled app, its easy
yeah, that's what i was planning to do. sadly it looks like something out of windows 95 haha.
what does?
normal tkinter code
i see, thanks for the info.
ye
Here's my code:
import subprocess
subprocess.call("ssh santiago@192.168.56.101", shell=True)
I'm building an electronjs app and I want to use python with it as I'm more familiar with it. I want to have a page that has an interactive terminal that displays on the window of the program. I have created a script in python that would allow you to do this in the terminal console however how can I use this code with electron to make a friendly gui terminal that you could use like any other.
Hi @weary wolf , I've told you once before! This is not a valid question for this channel. Please ask in the Electron server on Discord or StackOverflow! :)
Sorry but this is a user interface channel so I think it is exactly where I should be asking.
@weary wolf he just told you, also this is a python server
@unique forge I already took care of the situation, there wasn't a need for you to comment.
he asked another question though
And I responded.
how do you like the design
That is very cool
hey i need help
i cant find my desiner app
Looks good
Remember to never use plain text passwords!
Those "join our discord" and "visit us at" look kinda forced in, maybe move under the "welcome to ace launcher" and make transparent? @frank slate
The first line in your message() function has one too many spaces in front of it.
:incoming_envelope: :ok_hand: applied mute to @deep hornet until 2021-01-20 15:58 (9 minutes and 59 seconds) (reason: newlines rule: sent 12 consecutive newlines in 10s).
!unmute @deep hornet
:incoming_envelope: :ok_hand: pardoned infraction mute for @deep hornet.
!paste Please use a paste service for that
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.
ok
@analog field Only QGraphicsItem and objects subclassed from it contain hoverEnter/Leave events. If you're only interested in changing the appearance when a hover occurs you can use a stylesheet for that, otherwise you can use the enterEvent() but an enter event occurs any time the widget gains focus. That could happen from someone pressing the tab key, so you need to be careful with that.
The stylesheet for a hover event look like this: QPushButton:hover { color: #CCC }
@eager beacon Thanks, I figured it out a little bit ago but forgot to mention it here
Either way, your help is appreciated!
why isn't this working? ```py
def make_tab():
from tkinter import Tk
a = Tk()
a.after(100, make_tab)
make_tab()```
lol i forgot mainloop
can someone assist me with a Django issue in help-sulfur ?
i think i saw someone say Django is better suited for #web-development
idk im just repeating what they said
Does anyone know a way i could make it so the arrows in this diagram (which is the background of my GUI) could highlight when you hover your mouse over parts of the image
how do i make a scrolledtext take up to columns (tkinter)?
or have a input and a button take up one
I'm not very good at design, but, I can say that I think you accidentally spelled create wrong @digital rose.
I managed to delete all metro windows app
ill take that advice and see how it is!
import datetime
class Countdown(tk.Frame):
def __init__(self, master):
super().__init__(master)
self.create_widgets()
self.seconds_left = 0
self._timer_on = False
def show_widgets(self):
self.label.pack()
self.entry.pack()
self.start.pack()
def create_widgets(self):
self.label = tk.Label(self, text="00:00:00")
self.entry = tk.Entry(self, justify='center')
self.entry.focus_set()
self.start = tk.Button(self, text="Start",
command=self.start_button)
def countdown(self):
self.label['text'] = self.convert_seconds_left_to_time()
if self.seconds_left:
self.seconds_left -= 1
self._timer_on = self.after(1000, self.countdown)
else:
self._timer_on = False
def start_button(self):
# 1. to fetch the seconds
self.seconds_left = int(self.entry.get)
# 2. to prevent having multiple
self.stop_timer()
# Timers at once
self.countdown()
def stop_timer(self):
if self._timer_on:
self.after_cancel(self._timer_on)
self._timer_on = False
def convert_seconds_left_to_time(self):
return datetime.timedelta(seconds=self.seconds_left)
if __name__ == '__main__':
root = tk.Tk()
root.resizable(False, False)
countdown = Countdown(root)
countdown.pack()
root.mainloop()
anyone know why my GUI doesn't show?
It only shows the X to close it
like where itd be on the top right
try setting geometry for default width and size or set the state attribute to zoom for full window
Well I can stretch it out to be a full window GUI but there's nothing in there
even tho there should be a counter
You're not calling show_widgets, so the countdown frame will stay empty
hi
this is tkinter nice
the problem is you don't showing the widgets
by place or pack or grid
for example:
this will be don't showing any thing just the window
from tkinter import *
root = Tk()
root['background'] = "#323232"
root.geometry("600x400")
root.title('test')
# Let's add button
btn = Button(root,text="Click me",bg="#242424",fg="white",borderwidth=0)
root.mainloop()
output:
but when I .pack() the btn
like this:
from tkinter import *
root = Tk()
root['background'] = "#323232"
root.geometry("600x400")
root.title('test')
# Let's add button
btn = Button(root,text="Click me",bg="#242424",fg="white",borderwidth=0)
btn.pack()
root.mainloop()
the output is:
the button is showing up
you can use .place(x=*intvalue*, y=*intvalue*)
to put specific place
for example: btn.place(x=100,y=200)
also you can use .grid(row=*intvalue*, column=*intvalue*
this will be make a net
in the window
for example: btn.grid(row=5,column=2)
I hope you now know what I talking about.
Hey, what would be my best approach creating a python desktop app that uses html and vue for the UI, where i can send data to the UI and react to actions of the user? It's only for personal use, not for publishing
Hey, on my Python Tkinter GUI project, i need help on this page. The SELECT THEME button is supposted to copy a zipfile into the project files and then it is supposted to get unzipped there, and then it replaces an existing file. Can anyone help me on this?
def selectTheme() :
filename = filedialog.askopenfilename(initialdir="/", title="Select Theme File",
filetypes= (("Ace Theme File", "*.zip"), ("Ace Theme File", "*.zip")))
shutil.copy(src=filename, dst="Buttons")
with zipfile.ZipFile('Theme.zip', 'r') as my_zip:
my_zip.extractall('MainPages')
shutil.copytree(src='MainPages', dst="Buttons")
shutil.copytree doesn't overwrite directories if they exist. you will need to check if the directory exists and remove it before using copytree
how can you delete files with tkinter
I don't know how to do it with tkinter but you can use shutil since you've already imported it
how
if os.path.exists(dir_path):
shutil.rmtree(dir_path)
ok thanks
ive already imported os aswell so thanks
another question. how do i unzip files in another directory
with zipfile.ZipFile('Theme.zip', 'r') as my_zip:
my_zip.extractall('MainPages')
This only can unzip files in the same dir, but other dir doesnt work
or how do i move files into local dir with shutil
i mean the same dir
You probably need to provide a full path to the directory where you want the files extracted to
nono i want to extract a file in a different directory
with zipfile.ZipFile('Folder\Theme.zip', 'r') as my_zip:
my_zip.extractall('MainPages')
that doesnt work
Give it an absolute path and it should work C:\Path\To\Folder\Theme.zip
Assuming Folder has Theme.zip inside it.
oh you cant do local files?
If you want to read a zip file in another directory in your project you can give it a relative path but you have to take into account the working directory where your zip extract code is written
Its hard to give any more specific advice without knowing the directory structure of the project, where the zip file you want to extract is and in which file the extract code is written in.
I've just tested Tkinter, is there a table like widget ?
(working on a product manager)
I think you'd have to use the one from the ttkwidgets library or build your own.
closest is the ttk.Treeview
closest is the
ttk.Treeview
๐
I see
Honestly, I recommend ttk to every decent Tkinter user 
My button's command runs when it's initialized, but not when the button is actually pressed.
thats probably because your command is a function call, likely you just need to remove the parenthesis from the function in the command
Yeah, I read a stackoverflow answer saying the same thing you did at the same time you said it
It behaves as expected now... at least, that part.
awesome
This is my first time using Tkinter, so mistakes like that are to be expected
yeah, working with GUIs can take some getting use to but its a fairly short learning curve.
short on the X axis but tall on the Y axis -- it doesn't seem to take a long time to learn, but it's hard within that short time
When using bind() in tkinter, is this a one time line that occurs or do you have to do a bind in a loop?
I figured it out, just had to bind it in the main loop
How do I make it so the user cannot click into a text box?
Change the state of the text box to disabled or readonly.
is there anyone?
bilgiler = [numara,ad,soyad,phone,adres]
bilgiler[numara]= input ('numara gir')
bilgiler[ad] = input ('ad gir')
bilgiler[soyad] = input ('soyad gir')
bilgiler[phone] = input ('cep numara gir')
bilgiler[adres] = input ('adres gir')
ogrenci = { 'numara': bilgiler[numara] ,'adฤฑn' : bilgiler[ad], 'soyad' : bilgiler[soyad] , 'numarasฤฑ' : bilgiler[phone] ,
'adresi' : bilgiler[adres]
}
print (ogrenci)
```
why it's not working? where is the problem?
This is #user-interfaces , open a help channel by putting your question in one of the available ones
In the future you should use a help channel for questions like this #โ๏ฝhow-to-get-help
I don't get that how it's working. it opens a channel but I can't write anything
type your answer in one of these channels:
I wish python had a gui tool like grapejs for javascript ๐ฆ
@digital rose python isnt really for web dev
There is eel
@lofty pond The disable thing isn't effective because it doesnt allow me to insert into it while it's disabled.
Is there a way to make it so you cannot click on the widget? like a loop which unfocuses the mouse cursor?
I think there is readonly state, which allows you to insert, if that doesn't work, you could just enabled it before you insert and disable afterward
I tried that approach but the way i'm using the text box I can't enable and then disable. I will try the readonly thing.
To change a state of a widget before and after, just use:
widget.configure(state="state")
Ok
Can anyone please tell me how to add URL for lottie animation in html <lottie-player> that I have made myself (lottie.json) it is in JSON.
I am not using the animation from community of lottie files hence I don't have the URL for it.
When i used file manager's url, it showed CORS error.
What should I do?
hi
So I need to be able to stick or anchor my windows together side by side in groups.
I could use eventFilters and just move the attached windows relative to the one being moved.
But I was wondering if there is an easier way. Google yielded little information.
Im working with pyQt
@stray coral
If I'm understanding the problem correctly, the answer is to create QWidget with a layout and add them to the layout after they are created.
@eager beacon Hmm, that could work. Then just detach them from the QWidget when separeted, making it a standalone window again?
didnt know one could detach a QWidget from its parent
neat
You can't simply detach an existing widget from its parent if its a QWidget. You can however do that with a QMainWindow using a QDockWidget
You could just make it so when only one widget is in the dock it would not be removed. This would be to avoid having an empty main window hanging around. It would probably be more complicated than setting the position of the widgets based on the topRight position of their rect
hi
How do i make the gui look les ancient in tkinter
it looks kinda blurry and like it's meant for windows 7 or windows vista
on macos it looks fine but it looks like this on windows
The only crisp part is the title bar which is controlled directly by windows ๐ฆ
hdpitkinter look any different @pure cloak ?
Anyone in here who is familiar with briefcase/beeware? if yes i got a question:
Can i use other languages than "toga"? example tkinter?
Hey guys I was wondering how tkinter works when updating the canvas, does it redraw everything at each update or computes what's already present and add what's necessary to not waste resources?
It's an important question because I'm planning to use tkinter to draw a PIL image on the canvas, but this PIL image is costantly updating with new elements (basically generative art)
If there is someone, who can help me with tkinter, please DM me
I normally work in backend, but I have frontend web dev experience, and was wondering if there's a preffered python package for GUI. I've dabbled in tkinter and wasn't a huge fan, what other ones are there?
@upbeat nacelle PYQT5 or Pysimplegui, you can select one of them
pygame.init()
surface = pygame.display.set_mode((1280, 820))
def start_the_game():
pass
menu = pygame_menu.Menu(820, 1280, 'Welcome',
theme=pygame_menu.themes.THEME_ORANGE)
menu.add_text_input('Name :', default='DRIVEN TO LEARN')
menu.add_text_input(' Move the car with the arrow keys and dodge all obstacles, obtain a score of 250 to win')
menu.add_button('Play', start_the_game)
menu.add_button('Quit', pygame_menu.events.EXIT)
menu.mainloop(surface)
Could someone pls help what do I do at the def start_the_game function I'm done my game it's just the menu play button won't work and I don't know how to def start_the_game im new to python
THIS is due tmrw I am done my game just need some help to start the game through the menu if someone could pls help it would be appreciated.... this is for the menu for my game I have already made the game I just need the menu to play the game
How do I make it so that if the user expands the window horizontally, the window also expands by the same amount vertically and vice versa?
Basically I want the window to be square even when the user resizes the window (but I don't want to restrict resizing entirely)
.
How to clear all widgets from the Tk() window
why doesn't hide() work in pyqt?
no it was for a label, i forgot to call the function that hides it though ๐
Is this UI ok. Or do I need to make any changes to make it better. Designed without Designer. Androix86 Installer
Hi guys, quick question: is python a reliable language to make a deliverable GUI?
I tried once do a very simple user interface with PyQt5 and then tried to "box" it up on an executable but it occupied a lot more space than it needed. Admitedly I was doing it very naively and probably wasn't very careful with the imports and the executable was done with Pyinstaller and was not carefull with anything, just followed a simple tutorial
I'm just wondering what the overall opinion may be
I never worried about weight (i don't have much experience), but yes with the libraries out there, you can do anything in a somewhat efficient way
@hoary thicket I think it looks great
what should i use to make the thread sleep in pyqt?
time.sleep would just block the program
you don't use pyinstaller for packing gui's
you're not even compiling it, you just packing it
What should i look for then?
Well QT itself is modular to a point of plugins so you may not need that whole library for your deployment but I'm not sure how that maps to python bindings
Out of curiosity how it stands for you which version of QT what is used and how big the end package is
Is it like 30MiB, 150MiB, 600MiB
Well Im bit late ๐
is pyqt as capable or mature as electron? For example would I be able to build something like discord or microsoft teams using pyqt? Also is it as fast?
Yes, it's just as capable as electron. Qt was released something like 20+ years ago so its a very well structured, easy to understand and use library. PyQt is just a wrapper around C++ Qt so its probably just as fast as electron if not more so.
definitely needs less ram than electron
so umm i would be able to build something like discord with it?
Could you be more specific?
the issue is that i have not seen any big apps built with pyqt
i might be wrong though
it's just that i'm not really confident about picking up pyqt instead of electron
i really wanna because i'm good with python
but i haven't seen many big apps built with it
PyQt is a wrapper around Qt. Most companies don't have a good reason to write an app in PyQt when they have software devs who already know C++ and can use Qt.
I know Dropbox used PyQt for its desktop app.
There are tons of companies that use Qt to build their apps because its hands down the best cross platform framework for creating desktop applications.
Pretty much every Movie/Animation studio uses either PySide2 or PyQt5 to build internal tools, they also use it to create plugins for the apps they use that support Qt.
Adobe made all of its desktop software with Qt until around 2018 when they switched to the native frameworks. Autodesk uses it to build its applications. Houdini and Krita also use Qt.
If you plan to build something like discord though, a large part of your work won't involve the PyQt or Electron at all.
I don't understand the question
is it as good as using qt itself?
you write python code, it executes the Qt code
alright
its just a way to use Qt from Python
In which way
lol discord, microsoft teams, and atom were all built with electron
it's why i'm nervous
sidenote: PySide2 is the better Qt wrapper AFAIK
They use it because its easy to style
And yes, Pyside2 is maintained by the same company who makes Qt
I'm pretty sure PyQt5 is just one guy.
wait
isn't PyQt5 open source and PySide2 non open source - needs a license to use for commercial purposes?
PyQt5 requires a license for commercial apps period. Both PyQt5 and PySide2 may require you to have a Qt license depending on which modules the application includes.
There are also some modules in Qt that you can not use in your app unless it is open source.
hmm alright
ahh ok
is this channel about pyautogui too?
i guess
yes
can i really sell a Software made using Tkinter๐
@sudden geyser I guess...
wouldn't be very good though
tkinter looks like the 90s
use ttk
has a style for modern windows designs
or PyQt
It comes with tkinter
yes
anyone able to help, how i put my code into the gui?
Which one?
does the Qt Designer work with PyQt?
yes
i could help
know a lot of PyQt5
dm me
hey guys, ive been having some problems with kivymd. i had a top toolbar working properly, but when i added a floating button on the bottom of the screen, everything else disappeared. can anyone help me?
any kind of whole numbers
def button1_klik():
time.sleep(1)
canvas.create_oval(222.5, 195, 275, 240, fill="red", outline="black")
time.sleep(1)
canvas.create_oval(222.5, 140, 275, 185, fill="orange", outline="black")
time.sleep(1)
canvas.create_oval(222.5, 85, 275, 130, fill="green", outline="black")
does someone know how to make this not count 3 seconds but 1, execute, 1, execute etc.?
bc now it just waits 3 and then does all three
canvas.after(1000, changes_here)
thanks man
On Tkinter, how can I make that an Entry, a search bar calls a function whenever I press Enter?
I tried this but it doesn't work
window.bind('Return', function())
hello everyone is there a way for me to put a label beside a buttton improbably dumb so don't roast me
hello! does anyone know what library is the best for UI like buttons and stuff? thanks in advance!
@inner shale PyQt5
check out this app I made https://youtu.be/_CsLjA-Dq_o
Created a Login App with PyQt5 and MongoDB(PyMongo) Watch me in action! Comment Below if you want a full-length version, kinda like a tutorial.
Like the song?
Cycles from Geometry Dash by DJVI
Thank you @unique forge !
They used tkinter for that, not too sure on how.
For things like that theres likely os (pywin32) stuff going on
hello how can i print the information in the window, not in the cmd, when i click a button?
im from spain btw, if i write bad
use lambda:
and its <Return>
@unique forge saw ur vid and did this ๐
btw where can i get the documentation for the stylesheet thing
like background-color:rgb()
is it css?
thanks :))))
What do you mean by remove?
can anyone go to help aluminium? thanks :p
as in make the bg transparent
the QMainWindow
I don't think you can do that
at least not without making everything else transparent also
you can afaik
ik how to do it manually
wait lemme get the code for it
ahh nvm i cant find it
what i mean is
how can i remove the grey part and the titlebar
as in make it invisible
I don't think you can do that ๐ฆ
i am quite sure you can
ahh
@eager beacon QtWindow.framelessWindowHint or something
found it
now how do i implement into designer
this
yes you can do that but I don't think you can apply that in designer since its a flag.
Alright, it's not quite as easy as just setting the flag if you want a functional window though.
oh, what do i have to do then?
you have to override the mousePress/mouseMove/mouseRelease methods so you can move the window.
ahh properties?
and you have to do the calculations about how the window should move based on the press and actually do the movement in mouseMove
nice! btw, yes the stylesheets use CSS.
did you make it functional?
ok
taht looks good
Guys , how could i make if event that checks if anything in first list is in the second list ?
input_area = Entry(root)
input_area.pack()
input_area.get()
test = input_area.get()
def testing():
test_2 = Label(root, text=test)
test_2.pack()
button = Button(root, text='Sumbit', command=testing)
button.pack()
```My text isn't showing
It won't show as the get is called earlier
And the value has submitted
Move the test inside the function
oh ok
Worked?
Why you make a variable and why this. for example if you want variable do this:
test = StringVar()
input_area = Entry(root, textvariable=test)
input_area.pack()
def testing():
test_2 = Label(root, text=test.get())
test_2.pack()
button = Button(root, text='Sumbit', command=testing)
button.pack()
and if you don't want variable just do this without test:
input_area = Entry(root)
input_area.pack()
def testing():
test_2 = Label(root, text=input_area.get())
test_2.pack()
button = Button(root, text='Sumbit', command=testing)
button.pack()
and why you make this line
input_area.get()
```?
Guys I want help in .bind function
In what way?
Does anybody else use Google colab with Drive religiously?
for pysimplegui, i can only hit the button to run my script one time, is there any way to let it run my script each time the button is pressed?
I asked a PySide question in #help-chocolate if anyone is around to point me in the right direction
hi im trying to make a sudoku solver with tkinter where it shows all the moves its trying to attempt. so far i made it solve it but i want to make it show all the moves on the interface. I tried used .after() and time.sleep() but its not working as in the number isnt appearing in the interface when i try to slow it down can someone help me pls
i have a lot of code so its hard to show all of it
this is a sample of it
without the time.sleep part it solves it instantly
but im hoping that it will show every single possible move it is trying
if u know how to make a Python Menu dm me
is there a need to use pyuic for ui files that i create? or is there any other way to access ui files in py
Are you saying you don't want to convert the .ui to a .py?
Yeah, I suppose you could. You can import uic from PyQt5 and use uic.loadUi('file.ui')
I've only done this once so I don't really remember all of the details but I think you can inherit that like you would with a .py file that you created with pyuic.
you do still have to call self.setupUi(self) in your QWidget,QMainWindow,etc class though
Anyone familiar with how QTableWidget works?
I want to use ItemDelegate to show items but not for editing.
If you're using PyCharm and find youself constantly tweaking your UI file you can open your main.py file configuration and on that page you can define a set of scripts to run before launch. You could just put your pyuic command inside a bash script and run it automatically that way
I don't think you can use an ItemDelegate with a QTableWidget
It's showing the widget but only when I enter edit mode ๐ฆ
They are meant to be used with Views where you define your own model
I'm using QTableWidget.setItemDelegateForColumn
Have you subclassed the ItemDelagate?
I'm not really sure how to handle that outside of an AbstractModel. Thats where you usually handle the Roles(like the EditRole you're seeing)
maybe you could do it in the paint event by creating a UserRole for selected, check if its selected in paint event, then you could make it look however you wanted
btw, the docs recommend you use the StyledItemDelegate over the ItemDelegate.
Yeah, I'm using StyledItemDelegate right now
Maybe I need to override the paint method
thanks :))
Eww, overriding the paint() method is ugly
hey! i keep getting this traceback error in kivy and i cant seem to fix it:
line 892, in __init__
App.get_running_app().property("theme_cls", True),
AttributeError: 'NoneType' object has no attribute 'property'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
ValueError: KivyMD: App object must be initialized before loading root widget. See https://github.com/HeaTTheatR/KivyMD/wiki/Modules-Material-App#exceptions
why is it that a window previewed in designer is bigger than when running py code
for example :
Is PyQt5 paid?
Ok
nice
@modern marsh set a fixed size
also make sure to remove the surroundings
self.setWindowFlag(QtCore.Qt.FramelessWindowHint)
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
oh i will try that now
hello, I got a question
should I learn PyQt or Kivy to make a professional-looking and stylish GUI for a commercial program?
@noble hatch PyQt5 is great, but so is Kivy
it really depends what you're doing
Qt has Qt Designer, which makes everything a lot easier
apparently, PyQt is paid for commercial use
costs 500$ for commercial use, when kivy is free, but I guess 500$ is nothing when it comes to large-scale projects
ig PySide 2 wrapper is free
should I install PyQt or PySide?
in pyqt how would i use .setText while in a loop cause everytime it loops it deletes the previous text
i want it all the be there
@digital rose you can create a QTextEdit object then call insertPlainText("Say What...\n") on the object each loop.
or pull the current text value in to a variable then append the new text value then setText the new value...
how do i set a fixed size for my widgets in designer?
i tried setMinimumSize but it did not work
I think you can set the size of the widget by dragging it in designer and using the SizePolicies of Fixed/Fixed for width/height
if you're already locked into a layout just set the size you want with minimum and set it to Fixed SizePolicies
ooh
lemme try that
@eager beacon the window is smaller than it is in the QtDesigner preview
as i have shown above
how exactly do i fix that
i tried set minimum size and fixedPolicy
which widgets did you apply that to?
Apply it to the MainWindow
oh ok
and remove it from the green widget that's at a fixed size policy
so
only the mainWindow must be of fixed policy right?
others should be at their defaults
yes, if others are at their default they should fill the mainwindow
hmm
it still doesnt work
also
all of the widgets must have a minimum size right?
minimumSize should be 0 if they are at default settings
press the little arrow button to reset it to actual defaults
oh ok
ok so i made all the widgets except mainWindow default
without that the setMinimumSize will wind up in the .py file from pyuic
I'm not sure what that does to turn the code into python, I assume it does the same thing as pyuic without creating a .py file you need to import
yeah so if i do a = loadUi
i guess a will be the mainWindow object of that ui file
as per i have tried
If you want to paste your .ui file somewhere I can take a look at it but I can't say whats happening with out seeing it.
yeah use that
https://paste.pythondiscord.com/acaluduqiz.rb this is how im calling it
also Qt.FramelessWindowHint closes the app immediately when uncommented
idk why
and this is the reference for the image showing what is happening
i want that my app to be of the bigger size
here, I didn't set a fixed size on the main window and you're going to have to adjust some of the changes I made but it spreads correctly now: https://paste.pythondiscord.com/abefihucaw.xml
oh i will check that
oh you made a gridLayout huh
is it necessary to make layouts?
it's not necessary but it would make things so much easier if you used layouts
oh will do that from now
if you don't like the margins they provide, you can scroll down to the bottom of the properties and set the contents margins to 0
like you'll probably need to do that with the widget i put the window control buttons in
see how the top buttons are further down from the top and further from the right?
its because the green box has a margin of 12, and so does the widget that the 3 buttons are in.
oh
so if you set all of the margins for both of the widgets to 0 it should look how it does in your screenshot
oh ok
also, i ran your xml file
it still gives the same sized window
i guess the problem is my screen resolution?
im on a 4k screen
no, I said I never set a fixed size on the main window because I didn't know how big you wanted it
so you need to do that
that's the magic of a layout
so , i make a frame inside a window
and then add layouts right?
or should the frame itself be in a layout
are you using designer?
yes
so you really should make sure everything has a layout unless for some reason you plan to add a layout in python
except frame right?
also
suppose i want it to resize as it did in your xml
so should i add a global layout
Everything should have a layout
ahh nice
ok so i set a verticalLayout for the frame
and then put a horizontalLayout for the top buttons
inside it
but i cant resize it now
does everything have a layout?
yes
you added a layout from the side bar
no not really
for frame, i right clicked and selected
now you have to set a fixed size policy on that widget
and min/max sizes on the buttons
then use a spacerItem to push them all over to the right hand side
on the frame?
on the grey thing thats holding the buttons
well if that isn't intended to be the button box you need to add a widget to the frame
and put the buttons in that widget
and do what i said just a second ago to get the sizes right
wait so i should make another frame for the buttons?
okay that isn't what you want
you want a vertical layout on the frame
then a widget with an hbox layout for your buttons
then put the button widget in the frame
and add the other stuff below the button widget
make sense?
ahh ok yeah
makes sense
just that in the real python site and docs too ig ,i saw the nesting of layouts
thanks :))
you can nest layouts, but its good to have separate the functions of your app, and widgets can help do that. In your specific case though nesting wouldn't work correctly since an hbox would add any new layout to the right of the last widget
so you could do something like vbox on the frame, hbox for the buttons in the frame vbox and a second below the button hbox
but generally that just means you end up needing to mess with setting more custom margins and its more difficult to use the break layout option to reconfigure the layout.
๐
one problem now
the stylesheet border-radius attribute is not working for some reason
I set a min/max height/width of 18 i think
i put 16
if the rect height / width is less than border radius x2 you won't see an effect
you need to do it on both height and width
oh thats true
those clearly are still rectangles
ahh thanks :))
oh ok
you could do it with a paintEvent
its just 2 parallel lines with 2 arcs connecting the lines and an ellipse in the middle that moves to the other side of the rectangle when pressed
the most difficult part would be the animation to slow the movement of the ellipse when moving from one side to the other
you could use a QVariantAnimation for that
or a QTimeLine
so i make this all manually? or with Designer?
you'd have to program this.
I suppose you could create an imitation using a QSlider in designer
hmmm
its wouldn't be hard depending on your css skills
DerpGurkan is typing...
when i set this - setWindowFlag(Qt.FramelessWindowHint) my window opens and disappears
heh
ok
did you self it?
well i did self.login_ui.set.....
login_ui being from loadUI()
inside your def init
ahok
well thats the thing
it does not work
because i want that attribute on the .ui file i loaded in
yeah, so
self it
not self.ui
self
because its not for the Ui_MainWindow
its for your other class
whatever you named it
so you are saying that if i put the attribute to the global window , it applies to the windows loaded from ui file?
yes
well i did that and it did not work
holup lemme send code
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QPushButton
)
from PyQt5.QtCore import Qt
from PyQt5 import uic
import sys
class Main(QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
self.setGeometry(500, 500, 700, 1400)
self.setWindowFlag(Qt.FramelessWindowHint)
self.setupUi()
def setupUi(self):
self.login_ui = uic.loadUi('login.ui')
self.login_ui.show()
# self.login_ui.pushButton_4.clicked.connect(self.login)
# self.login_ui.setWindowFlag(Qt.FramelessWindowHint)
self.login_ui.setAttribute(Qt.WA_TranslucentBackground)
def login(self):
self.login_ui.destroy()
def setup():
app = QApplication(sys.argv)
window = Main()
sys.exit(app.exec_())
setup()```
perfect
mhm it does not work
see
...
hmm wait lemme try something
ayy it worked
i put the attribute after showing the window
also , its self.login_ui.set.....
threading is so hard for me ):
Hi
Anyone know how to make widget size increase as the text edit size increases?
On Pyqt5
it should be this
So there is no scrollbar and there is enough space to see everything?
I want the textedit to resize to its contents to fit
Tcl_AsyncDelete: async handler deleted by the wrong thread
whats this mean?
nvm
i get this now
self.textEdit.setText(
AttributeError: 'Thread' object has no attribute 'textEdit'
@glass dagger layouts
Hm?
layouts
Wdym
layouts
For the "problem" I was having?
No, what I meant was so that the TextEdit resizes
per the amount of content inside
so the scrollbar for it doesnt show up
I ended up using https://github.com/cameel/auto-resizing-text-edit
turn scroll bar off
use that then
No since then not the whole content would show
you can promote a textedit
I already did
to that
I already did it
But got an error so I downloaded it and instead of using pip I just used it directly into file
Since they use Pyqt and Im using pyside and now it works
from tkinter import *
from population import *
def open_window():
new_window = Toplevel(root)
new_window.title("Choose Countries:")
new_window.geometry("200x200")
listb = Listbox(new_window)
for country in countries_index:
listb.insert(0, country)
listb.pack()
Label(new_window,
text ="Country Selection").pack()
root = Tk()
root.geometry('450x450')
regions_btn = Button(root, text = 'Plot Regions', bd = '5', command = lambda : plot_regions())
top_btn = Button(root, text = 'Plot Top Countries', bd = '5', command = lambda : plot_top_countries())
slct_btn = Button(root, text = 'Plot Selected Countries', bd = '5', command = lambda : open_window())
regions_btn.pack(side = 'top')
top_btn.pack(side = 'top')
slct_btn.pack(side = 'top')
root.mainloop()
I am trying to create a ListBox that displays different countries. When the user selects a country, the country is added to a list. When the user deselects a country, the country is removed from the list. How do I implement this? I'm very lost.
I just started using PyQt5...
Do I have to download QT designer for designing?
you don't need it, but you'll probably be able to get started quicker if you don't have any experience with Qt.
hey, does anyone know if i should llearn kivy? is it good for begginers, or should i start with something like tkinter and then kivy?
Yeah first try tkinter then kiv and then go for PyQt
I'd go straight for Kivy. tkinter has less than stellar documentation and that can cause you to get stuck for longer than you should be.
hey, super beginner here, is it possible to use python to create a gui that then fill an excel file ? I got a student job and at this place they use a computer with an open excel sheet as a checkout. It's long and boring when people pay because I have to write the type and sub type of item, the price, the amount, et weight, all that manually x) So I'm wondering if it is possible to easily make a GUI with like dynamic box for the type and subtype and that can calculate the price instead of me
and fill the excel sheet
you could use csv files
I'm a total noob, just wondering if it's possible easily
do not use csv with excel , very frustrating to use
i have a problem in my code
so i made 2 ui files - login and base.ui
i open the login window first and it appears properly etc
but when i call the base window class , the window appears and disappears
!paste
ping pls :))
self ity
self it
@modern marsh all you have to do is self.window.show
and it works!
alright i will try that
it still doesnt work
probably has something to do with not creating Base in __main__ but instead in login, then using destroy on login
i removed the destory and made it such that the Base class is initiated in __main__ and then base_window.show() when i press the login button
and the window still behaves the same
If you want to zip your project files and send me a link I'll take a look when I get a chance
aight
I need help setting up my ubuntu to do graphical programming
Are you new to Ubuntu?