Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Text frame
Post: RE: Text frame

No idea how to do that using Python within AutoCAD, but you can do this in reportlab and save the pdf. You have to write the text and the box to something and save it. #https://docs.reportlab.com/re...
Pedroski55 Homework 2 440 May-18-2025, 07:39 PM
    Thread: Returning data on button click by buttons created by a loop
Post: RE: Returning data on button click by buttons crea...

This works for me: import tkinter as tk from tkinter import ttk def myApp(): # window root = tk.Tk() root.geometry('600x400') root.title('Button Demo') def button_click(butt...
Pedroski55 General Coding Help 3 591 Apr-23-2025, 03:01 PM
    Thread: image does not show with pillow
Post: RE: dado

Works fine for me using Idle as Python IDE and Ubuntu as OS from PIL import Image image = '/home/pedro/Pictures/icebergs_in_barbate.png' # Opens an image in RGB mode im = Image.open(image) # ...
Pedroski55 General Coding Help 5 1,702 Apr-13-2025, 04:16 PM
    Thread: Accessing method attributes of python class
Post: RE: Accessing method attributes of python class

If you return something from image() then you have it. class Frame: def __init__(self, width, height, factor): self.frame_width = width self.frame_height = height sel...
Pedroski55 General Coding Help 6 1,348 Apr-12-2025, 05:54 AM
    Thread: pivot
Post: RE: pivot

Don't know how I clicked on this old post, but I did. I tried pandas .pivot() and .pivot_table() without success, probably I did it wrong. But you can get the data in a basic way by using: list_df ...
Pedroski55 General Coding Help 1 653 Apr-11-2025, 04:13 AM
    Thread: Copying Data from Multiple XLS Files to a Cumulative Master File
Post: RE: Copying Data from Multiple XLS Files to a Cumu...

This will copy all data from all sheets from wed_cumula_2.xls to BNXT_202425.xlsx. No need to save the xls files as xlsx first. If you have other files with the same sheet names and column headers t...
Pedroski55 Data Science 3 1,271 Apr-05-2025, 05:07 AM
    Thread: pandas.json_normalize question
Post: RE: pandas.json_normalize question

csv files and json files are just text files, no need to get complicated! Your data is faulty. In SQL, a unique identifier, call it id if you like, is very important. I don't like the NaN values in ...
Pedroski55 Data Science 6 1,433 Apr-04-2025, 03:47 PM
    Thread: Copying Data from Multiple XLS Files to a Cumulative Master File
Post: RE: Copying Data from Multiple XLS Files to a Cumu...

Using xlrd you can read the xls files, then use openpyxl to save as xlsx files. import xlrd import openpyxl import xlrd from openpyxl import Workbook path2xl = '/home/pedro/Python_Virtual_Environme...
Pedroski55 Data Science 3 1,271 Apr-02-2025, 04:12 PM
    Thread: in c# create a loop counting from 0 to 5, consecutively
Post: RE: in c# create a loop counting from 0 to 5, cons...

Quote:In a cumulative average (CA), the data arrive in an ordered datum stream, and the user would like to get the average of all of the data up until the current datum. I think what we need here is...
Pedroski55 General Coding Help 19 2,886 Mar-30-2025, 07:00 AM
    Thread: I need help for my python homework (getting the user input into a .txt file)
Post: RE: I need help for my python homework (getting th...

Just looking at saving the data for now: as deanhystad said, you need to open a file and save the data to a file. Just using a name as an example: # declare the save path savepath = '/home/pedro/tem...
Pedroski55 Homework 5 1,287 Mar-24-2025, 06:27 PM
    Thread: in c# create a loop counting from 0 to 5, consecutively
Post: RE: in c# create a loop counting from 0 to 5, cons...

Terrible explanation! Basically, you want to check sales volume and share price for all shares you are interested in, I believe. If the price has risen by a certain amount, sell. You should provide ...
Pedroski55 General Coding Help 19 2,886 Mar-23-2025, 06:29 AM
    Thread: I am getting an IndentError on my python code in VS Code and i dont know why
Post: RE: I am getting an IndentError on my python code ...

I only use Idle to try things out. The following works fine in Idle. carros = ["mercedes", "toyota", "mazda", "bmw", "nissan", "hyundai", "byd"] colores = ['blanco', 'negro', 'rojo', 'amarillo', 'gri...
Pedroski55 General Coding Help 11 5,760 Mar-22-2025, 09:49 AM
    Thread: Camelot not able to change column header
Post: RE: Camelot not able to change column header

Post a couple of example pdfs. We can try to do what you want. I have never tried using camelot. pymupdf, aka fitz is very good at getting tables from pdfs, you might try that. pdfs are tricky, as...
Pedroski55 General Coding Help 2 893 Mar-22-2025, 04:47 AM
    Thread: python env with dictionary
Post: RE: python env with dictionary

I am not too sure what you want to do. I don't know what a .env file is. Your logging variable looks like a .json file. import json from pathlib import Path # don't save in /usr/log, I will use my /...
Pedroski55 General Coding Help 2 1,161 Mar-16-2025, 10:18 AM
    Thread: Nested loops vs list comprehension - pls. help
Post: RE: Nested loops vs list comprehension - pls. help

The exercise does not make sense! You are selling 4 different chairs at 4 different prices and each time in 3 different quantities? So you sell Chair 1 at 4 different prices [100, 120, 135, 150] in 3...
Pedroski55 Homework 5 1,093 Mar-16-2025, 05:32 AM
    Thread: Merge htm files with shutil library (TypeError: 'module' object is not callable)
Post: RE: Merge htm files with shutil library (TypeError...

htm or html files are text files. I don't have any .htm files, but I do have .html files! Why on earth you might want to shove all the htm* files together in 1 text file, I have no idea! How does th...
Pedroski55 General Coding Help 7 3,626 Mar-09-2025, 04:25 PM
    Thread: really new to python want to know how to do a loop
Post: RE: really new to python want to know how to do a ...

You are right! Using my psychic powers, I got it in 5! import random print("Guess a number between 1 and 1000:") secret_number = random.randint(1, 1000) while True: number = int(input("输入个数字 "...
Pedroski55 General Coding Help 6 1,838 Mar-09-2025, 07:51 AM
    Thread: really new to python want to know how to do a loop
Post: RE: really new to python want to know how to do a ...

If you use a while loop, the player will have unlimited guesses, unless you put some kind of counter in there. You should use a for loop for the game and a while loop to repeat the game as many times...
Pedroski55 General Coding Help 6 1,838 Mar-08-2025, 07:57 AM
    Thread: Excel password recovery tool for work
Post: RE: Excel password recovery tool for work

Back in the day, there were things called pencils. You could write with them. Now, if these forgetful managers had pencils, they could jot down their passwords on a little slip of paper, put it in t...
Pedroski55 General Coding Help 6 5,052 Mar-06-2025, 03:49 PM
    Thread: Exercise on reading a chunked file of a chess game state
Post: RE: Exercise on reading a chunked file of a chess ...

In your class these class variables are defined: def __init__(self): # Initialize values self._black = None self._white = None self._board = NoneThis function looks fo...
Pedroski55 Homework 1 746 Mar-03-2025, 05:52 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020